From 450f8df8865303f14be7ddd7c951f020115aa27c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Tue, 1 Apr 2025 18:18:33 -0400 Subject: [PATCH] Clarify that the transitionLanes used by Transition Tracing is a LaneMap (#32800) We have a high level concept for this used elsewhere. We should use this for `transitionTypes` too: https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactInternalTypes.js#L285 As mentioned in #32797 we could also just use the `transitionLanes` since the `types` are also on the `Transition` objects. If we always stored this set. --- packages/react-reconciler/src/ReactFiberRoot.js | 5 +---- packages/react-reconciler/src/ReactInternalTypes.js | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/react-reconciler/src/ReactFiberRoot.js b/packages/react-reconciler/src/ReactFiberRoot.js index 6812985582..fe88b95626 100644 --- a/packages/react-reconciler/src/ReactFiberRoot.js +++ b/packages/react-reconciler/src/ReactFiberRoot.js @@ -112,10 +112,7 @@ function FiberRootNode( this.incompleteTransitions = new Map(); if (enableTransitionTracing) { this.transitionCallbacks = null; - const transitionLanesMap = (this.transitionLanes = []); - for (let i = 0; i < TotalLanes; i++) { - transitionLanesMap.push(null); - } + this.transitionLanes = createLaneMap(null); } if (enableProfilerTimer && enableProfilerCommitHooks) { diff --git a/packages/react-reconciler/src/ReactInternalTypes.js b/packages/react-reconciler/src/ReactInternalTypes.js index 40ab04ffa3..f8e06456ee 100644 --- a/packages/react-reconciler/src/ReactInternalTypes.js +++ b/packages/react-reconciler/src/ReactInternalTypes.js @@ -357,7 +357,7 @@ export type TransitionTracingCallbacks = { // The following fields are only used in transition tracing in Profile builds type TransitionTracingOnlyFiberRootProperties = { transitionCallbacks: null | TransitionTracingCallbacks, - transitionLanes: Array | null>, + transitionLanes: LaneMap | null>, // Transitions on the root can be represented as a bunch of tracing markers. // Each entangled group of transitions can be treated as a tracing marker. // It will have a set of pending suspense boundaries. These transitions