@samitouri / QOS-React / commits / 676f0879f3

Reset currentEventTransitionLane after flushing sync work (#33159)

This keeps track of the transition lane allocated for this event. I want to be able to use the current one within sync work flushing to know which lane needs its loading indicator cleared. It's also a bit weird that transition work scheduled inside sync updates in the same event aren't entangled with other transitions in that event when `flushSync` is. Therefore this moves it to reset after flushing. It should have no impact. Just splitting it out into a separate PR for an abundance of caution. The only thing this might affect would be if the React internals throws and it doesn't reset after. But really it doesn't really have to reset and they're all entangled anyway.

Sebastian Markbåge committed May 13, 2025 at 15:18 UTC 676f0879f315130309262ff3532707029f0288bb
1 file changed +3 -1
packages/react-reconciler/src/ReactFiberRootScheduler.js
+3 -1
@@ -257,7 +257,6 @@ function processRootScheduleInMicrotask() {
257 // preserve the scroll position of the previous page.
258 syncTransitionLanes = currentEventTransitionLane;
259 }
260 - currentEventTransitionLane = NoLane;
260 }
261
262 const currentTime = now();
@@ -315,6 +314,9 @@ function processRootScheduleInMicrotask() {
314 if (!hasPendingCommitEffects()) {
315 flushSyncWorkAcrossRoots_impl(syncTransitionLanes, false);
316 }
317 +
318 + // Reset Event Transition Lane so that we allocate a new one next time.
319 + currentEventTransitionLane = NoLane;
320 }
321
322 function scheduleTaskForRootDuringMicrotask(