@@ -27,6 +27,7 @@ import {
27
27
transitionLaneExpirationMs ,
28
28
retryLaneExpirationMs ,
29
29
disableLegacyMode ,
30
+ enableSiblingPrerendering ,
30
31
} from 'shared/ReactFeatureFlags' ;
31
32
import { isDevToolsPresent } from './ReactFiberDevToolsHook' ;
32
33
import { clz32 } from './clz32' ;
@@ -270,11 +271,13 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
270
271
if ( nonIdlePingedLanes !== NoLanes ) {
271
272
nextLanes = getHighestPriorityLanes ( nonIdlePingedLanes ) ;
272
273
} else {
273
- // Nothing has been pinged. Check for lanes that need to be prewarmed.
274
- if ( ! rootHasPendingCommit ) {
275
- const lanesToPrewarm = nonIdlePendingLanes & ~ warmLanes ;
276
- if ( lanesToPrewarm !== NoLanes ) {
277
- nextLanes = getHighestPriorityLanes ( lanesToPrewarm ) ;
274
+ if ( enableSiblingPrerendering ) {
275
+ // Nothing has been pinged. Check for lanes that need to be prewarmed.
276
+ if ( ! rootHasPendingCommit ) {
277
+ const lanesToPrewarm = nonIdlePendingLanes & ~ warmLanes ;
278
+ if ( lanesToPrewarm !== NoLanes ) {
279
+ nextLanes = getHighestPriorityLanes ( lanesToPrewarm ) ;
280
+ }
278
281
}
279
282
}
280
283
}
@@ -294,11 +297,13 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
294
297
if ( pingedLanes !== NoLanes ) {
295
298
nextLanes = getHighestPriorityLanes ( pingedLanes ) ;
296
299
} else {
297
- // Nothing has been pinged. Check for lanes that need to be prewarmed.
298
- if ( ! rootHasPendingCommit ) {
299
- const lanesToPrewarm = pendingLanes & ~ warmLanes ;
300
- if ( lanesToPrewarm !== NoLanes ) {
301
- nextLanes = getHighestPriorityLanes ( lanesToPrewarm ) ;
300
+ if ( enableSiblingPrerendering ) {
301
+ // Nothing has been pinged. Check for lanes that need to be prewarmed.
302
+ if ( ! rootHasPendingCommit ) {
303
+ const lanesToPrewarm = pendingLanes & ~ warmLanes ;
304
+ if ( lanesToPrewarm !== NoLanes ) {
305
+ nextLanes = getHighestPriorityLanes ( lanesToPrewarm ) ;
306
+ }
302
307
}
303
308
}
304
309
}
@@ -760,12 +765,14 @@ export function markRootSuspended(
760
765
root : FiberRoot ,
761
766
suspendedLanes : Lanes ,
762
767
spawnedLane : Lane ,
763
- didSkipSuspendedSiblings : boolean ,
768
+ didAttemptEntireTree : boolean ,
764
769
) {
770
+ // TODO: Split this into separate functions for marking the root at the end of
771
+ // a render attempt versus suspending while the root is still in progress.
765
772
root . suspendedLanes |= suspendedLanes ;
766
773
root . pingedLanes &= ~ suspendedLanes ;
767
774
768
- if ( ! didSkipSuspendedSiblings ) {
775
+ if ( enableSiblingPrerendering && didAttemptEntireTree ) {
769
776
// Mark these lanes as warm so we know there's nothing else to work on.
770
777
root . warmLanes |= suspendedLanes ;
771
778
} else {
@@ -876,6 +883,7 @@ export function markRootFinished(
876
883
// suspended) instead of the regular mode (i.e. unwind and skip the siblings
877
884
// as soon as something suspends to unblock the rest of the update).
878
885
if (
886
+ enableSiblingPrerendering &&
879
887
suspendedRetryLanes !== NoLanes &&
880
888
// Note that we only do this if there were no updates since we started
881
889
// rendering. This mirrors the logic in markRootUpdated — whenever we
0 commit comments