You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempting to proxy an instance of a class, and within that proxy change the enumerability of specific keys through getOwnPropertyDescriptor trap.
Actual outcome:
See codeSandbox, when proxying the instance of a class, any attempts to alter the enumerability of an observable property through getOwnPropertyDescriptor trap throws the error:
TypeError: 'getOwnPropertyDescriptor' on proxy: trap returned descriptor for property 'id' that is incompatible with the existing property in the proxy target
This works with basic objects, however something about classes prevents the altering of any enumerability through the proxy. I believe this may be intentional, due to the warning given for the linting option safeDescriptors:
MobX makes some fields non-configurable or non-writable to prevent you from doing things that are not supported or would most likely break your code.
Is this a bug or is this intentional behavior? I would like to find a way to make this possible for my use case with classes, and it seems strange that objects would allow this but classes wouldn't. Any guidance is appreciated.
Intended outcome:
Attempting to proxy an instance of a class, and within that proxy change the enumerability of specific keys through getOwnPropertyDescriptor trap.
Actual outcome:
See codeSandbox, when proxying the instance of a class, any attempts to alter the enumerability of an observable property through getOwnPropertyDescriptor trap throws the error:
This works with basic objects, however something about classes prevents the altering of any enumerability through the proxy. I believe this may be intentional, due to the warning given for the linting option safeDescriptors:
MobX makes some fields non-configurable or non-writable to prevent you from doing things that are not supported or would most likely break your code.
Is this a bug or is this intentional behavior? I would like to find a way to make this possible for my use case with classes, and it seems strange that objects would allow this but classes wouldn't. Any guidance is appreciated.
How to reproduce the issue:
See codeSandbox.
Also, I apologize if this isn't really a bug and more of a question.
The text was updated successfully, but these errors were encountered: