-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Always pull force flag from component #1984
Conversation
96c97c7
to
4078c77
Compare
4078c77
to
8009143
Compare
The way MobX works is that every observed component returns false from shouldComponentUpdate unless props have changed. They than trigger the child renders themselves via direct forceUpdate calls. Our issue was that we only set the force flag sort-of globally during a render and would ignore any children that have been enqueued via forceUpdate in the same render cycle. With these changes we ensure that the force flag is always the one from the current component.
8009143
to
c3b9cd6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! I wanted to dig into this later too hehe beat me to it! Hero! 💯
Wow! 😁 |
@marvinhagemeister Woo! Love it when we can save bytes and fix bugs :) In In the UT that you added, do we also need to clear the components I took a stab at this but wanted to drop a message here so someone can look at it in case I forget. |
@andrewiggins Good catch! That's something I didn't think of. Maybe we just need to reset the flag at the end of |
The way MobX works is that every observed component returns false from shouldComponentUpdate unless props have changed. They than trigger the child renders themselves via direct forceUpdate calls. Our issue was that we only set the force flag sort-of globally during a render and would ignore any children that have been enqueued via forceUpdate in the same render cycle. With these changes we ensure that the force flag is always the one from the current component.
The way MobX works is that every observed component returns
false
fromshouldComponentUpdate
unlessprops
have changed. They than trigger the child renders themselves via directforceUpdate
calls.Our issue was that we only set the
force
flag sort-of globally during a render and would ignore any children that have been enqueued viaforceUpdate
in the same render cycle. This PR addresses that by ensuring that theforce
flag is always the one from the current component.Tasks:
Fixes #1983
Size
-24 B
💯