Skip to content

Commit 38ae8ba

Browse files
committed
Clear update tracking if we skip rendering a gesture lane
We need to clear any updates scheduled so that we can treat future updates as the cause of the render.
1 parent 02296dc commit 38ae8ba

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/react-reconciler/src/ReactFiberWorkLoop.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ import {
307307
transitionSuspendedTime,
308308
clearBlockingTimers,
309309
clearGestureTimers,
310+
clearGestureUpdates,
310311
clearTransitionTimers,
311312
clampBlockingTimers,
312313
clampGestureTimers,
@@ -3531,6 +3532,11 @@ function commitRoot(
35313532
// Gestures don't clear their lanes while the gesture is still active but it
35323533
// might not be scheduled to do any more renders and so we shouldn't schedule
35333534
// any more gesture lane work until a new gesture is scheduled.
3535+
if (enableProfilerTimer && (remainingLanes & GestureLane) !== NoLanes) {
3536+
// We need to clear any updates scheduled so that we can treat future updates
3537+
// as the cause of the render.
3538+
clearGestureUpdates();
3539+
}
35343540
remainingLanes &= ~GestureLane;
35353541
}
35363542

packages/react-reconciler/src/ReactProfilerTimer.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,16 @@ export function clearGestureTimers(): void {
371371
gestureClampTime = now();
372372
}
373373

374+
export function clearGestureUpdates(): void {
375+
// Same as clearGestureTimers but doesn't reset the clamp time because we didn't
376+
// actually emit a render.
377+
gestureStartTime = -1.1;
378+
gestureUpdateTime = -1.1;
379+
gestureUpdateType = 0;
380+
gestureSuspendedTime = -1.1;
381+
gestureEventIsRepeat = true;
382+
}
383+
374384
export function clampBlockingTimers(finalTime: number): void {
375385
if (!enableProfilerTimer || !enableComponentPerformanceTrack) {
376386
return;

0 commit comments

Comments
 (0)