-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
[Fiber] Refactor Commit Phase into Separate Functions for Before Mutation/Mutation/Layout #31930
base: main
Are you sure you want to change the base?
Conversation
This is an unusual flag that doesn't serve a special return value. We can just use the global flag and reset it before the next mutation phase. Unlike focusedInstanceHandle this doesn't leak any memory in the meantime.
We're already setting the update priority around user space code.
The execution scope of the commit isn't as useful for profiling information.
This aligns it with passive effects. We can cancel these using the timeoutHandle or cancelPendingCommit. We should never run a commit function that was cancelled. We can check these to determine whether there are any pending commits.
Because ReactFiberLane is imported for its constants it cannot depend on the config.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -744,6 +744,7 @@ describe('ReactDeferredValue', () => { | |||
</Container>, | |||
); | |||
// We should switch to pre-rendering the new preview. | |||
await waitForPaint([]); |
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.
This happens because the requestPaint()
is now unconditional even if there weren't any effects. Which doesn't really hurt anything since it's actually a noop in anything but tests and should probably go away.
@@ -3460,7 +3471,8 @@ function commitRootImpl( | |||
} | |||
} | |||
|
|||
onCommitRootDevTools(finishedWork.stateNode, renderPriorityLevel); |
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.
This one is a bit strange because the profiler in devtools tracks the priority level that the commit phase is running in rather than what priority was rendered and then committed. I think the idea is that it would be running in the scheduler priority of the render but that's not necessarily the case for the commit.
Stacked on #31922.
This is doing some general clean up to be able to split the commit root three phases into three separate async steps.