-
-
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
MobX 7 roadmap #3796
Comments
awesome news! It looks like the new version will be focused on removing deprecated stuff and updating the build system instead of introducing new features or breaking changes. It should be a breeze to upgrade! |
I have a somewhat controversial suggestion: automatically bind class methods in Rationale: People might forget to bind
Developers these days don't usually deal with While there might be reasons to preserve the original computed: {
// a computed getter
reversedMessage: function () {
// `this` points to the vm instance
return this.message.split('').reverse().join('')
}
} Perhaps we could even consider making new |
As a long-time user of MobX I would be in favor of keeping support for mobx-react / observer classes as it's still fully supported by React. I understand why new code bases might not use class based components, but for existing code bases it doesn't necessarily make sense to migrate all existing code if it still works well. |
Interesting! The rationale for not doing so was that autobinding is expensive; it creates a function closure per instance rather than per type. MST does autobinding and I regretted that, due to the mem / cpu consumption. So I'm a bit torn on this one, being able to opt out can avoid the MST problem. On the other hand, if |
Without provider / inject, and non-reactive props/state like in the latest version, |
That sounds great! |
Hi @mweststrate can we keep observer for class? Even though functional/hooks React components are very popular in nowdays, Oop programming is still very highly efficient for some UI interaction complex scenarios. Eg: When 2 pages are 90% similar, we can finish Page A. Page B can extend Page A and share 90% of the code, only overriding 10%. The code between PageA and PageB is completely isolated and not coupled. so the code is very clean, which is conducive to later maintenance. @observer
class PageA extends React.component {
renderSharedSection() {...}
renderDiffSection() {...}
render() {
return (
<>
{this.renderSharedSection()}
{this.renderDiffSection()}
</>
);
}
}
class PageB extends PageA {
renderDiffSection() {...}
} Currently, we are in charge of more than 20+ products, web-IDE, data visualization etc... hope you can keep observer for class in the V7 version (Since v6 doesn't support @ decorator, we are very excited to know V7 is coming 😂) |
@vincentLiuxiang see also the comments just before yours :). Rephrased in the proposal. P.s. v6 does support |
👍👍👍 would like to confirm whether there is any API incompatibility when upgrading from 6.10.0 to 6.11.0 ? |
not by design (unless you switch from legacy to modern decorators) |
Considering the massive feature removal, sounds like the bundle size will be significantly reduced 👍 |
Can there be a clear upgrade path for large codebases? For example if there are breaking changes can codemods be provided? Or alternatively, can the breaking changes be made in such a way that consumers could write their own codemods? If you'd like feedback on what breaks / what works in large codebases at certain points through this roadmap I would be happy to contribute. |
It's worth pinning this issue <3 |
@mweststrate You're referring to intercept and observe here, not the observer HOC correct? |
is there an alternative to intercept and observe? mobx-keystone relies on those heavilty |
I'm against default { autobind: true }, we had many stores store class
eslint knows nothing about magic autobind for setSelectedOption and complains in every such method usage as event handlers. We fixed this with proper use of arrow function instead of plain method
As result we have clear readable validated code with correct binding without any autobind magic. Plese don't add autobind as default (@kubk @mweststrate). |
[WIP for now, needed the issue number]
StubArray
workaround is incompatible with terser'sunsafe_arrows
option #3825)MobX 8 or later
The text was updated successfully, but these errors were encountered: