-
Notifications
You must be signed in to change notification settings - Fork 50.4k
Entangle Gesture revert commit with the corresponding Action commit #35487
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
base: main
Are you sure you want to change the base?
Conversation
Instead of keeping track of which gestures to stop during the next commit, we instead track on the pending gesture whether that gesture should commit that lane next time we get there in the React commit sequence.
When completing a root we can apply the gesture which starts the animation but it's not committed. We mark the lane as suspended at that point.
This will rerender the gesture lane and then commit it which stops the gesture. After that any Transitions can be applied on top.
…commits This part doesn't animate until we release.
| // so that we commit them all together. | ||
| if (gesture.revertLane !== NoLane) { | ||
| const entangledLanes = gesture.revertLane | requestTransitionLane(null); | ||
| markRootEntangled(root, entangledLanes); |
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.
One thing that's a bit strange with this one is that the revert lane isn't actually scheduled at this point yet because it's not pending until we actually commit the gesture lane which is the one that leaves the work behind. Ideally this should probably be done somewhere in the commit phase instead.
|
Comparing: 5aec1b2...db5f538 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show |
Stacked on #35486.
When a Gesture commits, it leaves behind work on a Transition lane (
revertLane). This entangles that lane with whatever lane we're using in the event that cancels the Gesture. This ensures that the revert and the result of any resulting Action commits as one batch. Typically the Action would apply a new state that is similar or the same as the revert of the Gesture.This makes it resilient to unbatching in #35392.