Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend Object prototype for message instances #618

Merged
merged 4 commits into from
Mar 13, 2024

Conversation

eric-higgins-ai
Copy link
Contributor

After #582, message instances don't behave exactly like simple objects, as their prototype only includes a Symbol("protobuf-ts/message-type") field and is missing fields normally present in a simple object (e.g. constructor). For us, this specifically causes an issue when using mobx to observe changes to message instances - it only allows observing objects that have a constructor method in their prototype that matches the method for simple objects.

This fixes the problem by copying the default object prototype and adding a Symbol("protobuf-ts/message-type") field, rather than starting from an empty prototype.

@timostamm
Copy link
Owner

@erichiggins0, CI was failing because of an issue with go. Pushed up #636 to your fork.

Copy link
Owner

@timostamm timostamm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the discussion in #582 (comment), LGTM.

@timostamm timostamm merged commit d2b1db3 into timostamm:main Mar 13, 2024
1 check passed
@timostamm
Copy link
Owner

Released in v2.9.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants