Skip to content

Commit 21cd559

Browse files
committed
Only queue transition types on roots that have transitions scheduled
1 parent cccc144 commit 21cd559

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

packages/react-reconciler/src/ReactFiberTransitionTypes.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {FiberRoot} from './ReactInternalTypes';
1111
import type {TransitionTypes} from 'react/src/ReactTransitionType';
1212

1313
import {enableViewTransition} from 'shared/ReactFeatureFlags';
14+
import {includesTransitionLane} from './ReactFiberLane';
1415

1516
export function queueTransitionTypes(
1617
root: FiberRoot,
@@ -20,14 +21,16 @@ export function queueTransitionTypes(
2021
// TODO: We should really store transitionTypes per lane in a LaneMap on
2122
// the root. Then merge it when we commit. We currently assume that all
2223
// Transitions are entangled.
23-
let queued = root.transitionTypes;
24-
if (queued === null) {
25-
queued = root.transitionTypes = [];
26-
}
27-
for (let i = 0; i < transitionTypes.length; i++) {
28-
const transitionType = transitionTypes[i];
29-
if (queued.indexOf(transitionType) === -1) {
30-
queued.push(transitionType);
24+
if (includesTransitionLane(root.pendingLanes)) {
25+
let queued = root.transitionTypes;
26+
if (queued === null) {
27+
queued = root.transitionTypes = [];
28+
}
29+
for (let i = 0; i < transitionTypes.length; i++) {
30+
const transitionType = transitionTypes[i];
31+
if (queued.indexOf(transitionType) === -1) {
32+
queued.push(transitionType);
33+
}
3134
}
3235
}
3336
}

0 commit comments

Comments
 (0)