-
Notifications
You must be signed in to change notification settings - Fork 46.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
Remove renderPhaseUpdates Map #17484
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b384dd1:
|
Details of bundled changes.Comparing: be603f5...b384dd1 react-reconciler
react-dom
react-art
react-test-renderer
react-native-renderer
ReactDOM: size: 🔺+0.2%, gzip: 🔺+0.2% Size changes (stable) |
Details of bundled changes.Comparing: be603f5...b384dd1 react-native-renderer
react-test-renderer
react-dom
react-art
react-reconciler
Size changes (experimental) |
e2a1384
to
3f3c8b4
Compare
I should also make the infinite loop error use a dispatcher: #17480 (comment) |
3f3c8b4
to
0f85d01
Compare
Inside |
0f85d01
to
6388040
Compare
When aborting a render, we also need to throw out render phase updates. Remove the updates from the queues so they do not persist to the next render. We already did a single pass through the whole list of hooks, so we know that any pending updates must have been dispatched during the render phase. The ones that were dispatched before we started rendering were already transferred to the current hook's queue.
Fixed the todo and merged after discussing out of band. |
Follow up to facebook#17484, which was reverted due to a bug found in www.
// It's also called inside mountIndeterminateComponent if we determine the | ||
// component is a module-style component. | ||
if (didScheduleRenderPhaseUpdate) { | ||
const current = (currentlyRenderingFiber: any).alternate; |
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.
@acdlite What if this is render phase updates during initial mount?
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.
It doesn't matter then because either the whole fiber will get thrown out or it will be cloned again. Except in legacy mode goddamn it. I'll add a test in the other PR.
Follow up to facebook#17484, which was reverted due to a bug found in www.
Follow up to facebook#17484, which was reverted due to a bug found in www.
Follow up to facebook#17484, which was reverted due to a bug found in www.
Follow up to facebook#17484, which was reverted due to a bug found in www.
Follow up to facebook#17484, which was reverted due to a bug found in www.
* Remove renderPhaseUpdates Map Follow up to #17484, which was reverted due to a bug found in www. * Failing test: Dropped updates When resetting render phase updates after a throw, we should only clear the pending queue of hooks that were already processed. * Fix non-render-phase updates being dropped Detects if a queue has been processed by whether the hook was cloned. If we change the implementation to an array instead of a list, we'll need some other mechanism to determine whether the hook was processed. * Regression test: startTransition in render phase useTransition uses the state hook as part of its implementation, so we need to fork it in the dispatcher used for re-renders, too.
Builds on top of #17483
Now that we have a separate queue for recently added updates, we can use this queue to pick up the render phase updates. As long as we clear them before committing.
TODO: I believe this might have a bug if you suspend during the second update but before we get to process this particular Hook. Since the update would remain in the queue in this case.