Skip to content

Commit 2487830

Browse files
committed
Schedule work on the root if there's lower prio than gesture lane
If we cancel a gesture before it has a chance to commit we still leave the lane In this case we need to just skip it.
1 parent 4045cd5 commit 2487830

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/react-reconciler/src/ReactFiberWorkLoop.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3875,10 +3875,10 @@ function commitGestureOnRoot(
38753875
// We assume that the gesture we just rendered was the first one in the queue.
38763876
const finishedGesture = root.pendingGestures;
38773877
if (finishedGesture === null) {
3878-
throw new Error(
3879-
'Finished rendering the gesture lane but there were no pending gestures. ' +
3880-
'React should not have started a render in this case. This is a bug in React.',
3881-
);
3878+
// We must have already cancelled this gesture before we had a chance to
3879+
// render it. Let's schedule work on the next set of lanes.
3880+
ensureRootIsScheduled(root);
3881+
return;
38823882
}
38833883
deleteScheduledGesture(root, finishedGesture);
38843884

@@ -3961,6 +3961,9 @@ function flushGestureAnimations(): void {
39613961
setCurrentUpdatePriority(previousPriority);
39623962
ReactSharedInternals.T = prevTransition;
39633963
}
3964+
3965+
// Now that we've rendered this lane. Start working on the next lane.
3966+
ensureRootIsScheduled(root);
39643967
}
39653968

39663969
function makeErrorInfo(componentStack: ?string) {

0 commit comments

Comments
 (0)