-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Cannot decorate undefined property with deep inheritance #2633
Comments
You shouldn't call |
If Seems like the |
I've uncommented observbales/actions in B/C and commented out |
As a work around, I think in principle it should work fine to not apply |
Good call, thanks, but didn't work either (tried with the example). |
What do you guys think about something like a mobx specific version of util/inherits designed for extending mobx decorated classes? I've found this is a huge foot gun and really hard to track down the source of the problem. From a user perspective, it would have the benefit of making it very obvious that a subclass's parent has mobx observable members. I'm ofc not a maintainer, but from a maintainers perspective, it might be easier to have a single point of origin to work on all class extending related issues |
@jeremy-coleman Have you checked #2641? It restricts overriding only to actions defined on prototype and should throw in all other cases. However it's not entierely BC. |
I did , thank you for directing me there and your work on the pr. I have been thinking about it for a while, but still unsure of any conclusion. |
This worked for my use case, thank you! Would still be great if #2641 was a remedy for this issue as well, because |
MobX 6.1.0 has been released with improved inheritance, which should address this issue. |
Reproducible example:
Please, have a look at
CodeSandBox.
Copy of the code
How to reproduce the issue:
Uncomment either one from
// UNCOMMENT ME TO BREAK
sections to see an error:
Then comment either one from
// COMMENT ME TO REPAIR
sections to remove the error.
Versions:
mobx@6.0.4
typescript@4.1.2
,"useDefineForClassFields": true
@babel/plugin-proposal-class-properties@7.12.1
,"loose": false
The text was updated successfully, but these errors were encountered: