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
Reintroduce observable state,props,context in mobx-react #3863
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 6ff48f3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Hi @urugator what do you think about this PR? do you think it's safe to reintroduce the observability? |
While the global state version was the main motivation for this change, we had other reasons, some conceptual, some technical. I will share parts of our discussion:
Another problem with the implementation is that shallow equality check runs twice for props/state/context on every component update - in each setter to decide whether atom should If we are to reintroduce observable props (the decision is on @mweststrate), I would at least like to see the above problems addressed:
Both can be probably workarounded, but it's some extra work and unknown problems may emerge (getting back to pilling patches point). |
Hi @urugator thanks for the informative reply.
I tested your linked test case on my branch, it seems to me that Child does render 2 times in total which is desired as per comment, I'm not sure how to reproduce the unnecessary render (3 times) you described. In that example, Parent passes
I agree there are some performance benefits from achieving this, I spent few hours and I couldn't achieve it in a good manner. However, (this is hacking React) that react reconciler always call We would really appreciate it if we could make observable props behind a config, at least people like us can opt-in this feature |
As described in #3858
Code change checklist
/docs
. For new functionality, at leastAPI.md
should be updatedyarn mobx test:performance
)