-
Notifications
You must be signed in to change notification settings - Fork 45.6k
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
Do not add additional work to a batch that is already rendering #13072
Do not add additional work to a batch that is already rendering #13072
Conversation
ReactDOM: size: 🔺+0.1%, gzip: 🔺+0.1% Details of bundled changes.Comparing: 4fe6eec...4be858d react-dom
react-art
react-test-renderer
react-reconciler
react-native-renderer
Generated by 🚫 dangerJS |
@@ -1086,6 +1086,8 @@ function renderRoot(root: FiberRoot, isYieldy: boolean): void { | |||
if (__DEV__) { | |||
resetStackAfterFatalErrorInDev(); | |||
} | |||
// Clear the currently rendering root. |
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.
These comments are not helpful. Obviously you're clearing the root based on the next line. Say why, not what you're doing.
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.
E.g. "By clearing the root, we force React to start over by rendering the root from scratch instead of continuing in the middle of the tree. We have to do that because we've added new work to the tree and that might otherwise be inconsistent depending on where we are in the current render."
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.
Ok Seb, I know what a comment is. Thanks for the explanation.
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.
"Better comment, please" would have sufficed
92e981c
to
dfcbfa7
Compare
Otherwise, the part of the tree that hasn't rendered yet will receive the latest state, but the already rendered part will show the state as it was before the intervening update.
dfcbfa7
to
4be858d
Compare
Depends on #13071
Otherwise, the part of the tree that hasn't rendered yet will receive the latest state, but the already rendered part will show the state as it was before the intervening update.