@@ -20,9 +20,10 @@ import {
2020 enableCache ,
2121 enableSchedulingProfiler ,
2222 enableUpdaterTracking ,
23- enableSyncDefaultUpdates ,
23+ allowConcurrentByDefault ,
2424} from 'shared/ReactFeatureFlags' ;
2525import { isDevToolsPresent } from './ReactFiberDevToolsHook.new' ;
26+ import { ConcurrentUpdatesByDefaultMode , NoMode } from './ReactTypeOfMode' ;
2627
2728// Lane values below should be kept in sync with getLabelsForLanes(), used by react-devtools-scheduling-profiler.
2829// If those values are changed that package should be rebuilt and redeployed.
@@ -253,11 +254,12 @@ export function getNextLanes(root: FiberRoot, wipLanes: Lanes): Lanes {
253254 }
254255
255256 if (
256- // TODO: Check for root override, once that lands
257- enableSyncDefaultUpdates &&
258- ( nextLanes & InputContinuousLane ) !== NoLanes
257+ allowConcurrentByDefault &&
258+ ( root . current . mode & ConcurrentUpdatesByDefaultMode ) !== NoMode
259259 ) {
260- // When updates are sync by default, we entangle continous priority updates
260+ // Do nothing, use the lanes as they were assigned.
261+ } else if ( ( nextLanes & InputContinuousLane ) !== NoLanes ) {
262+ // When updates are sync by default, we entangle continuous priority updates
261263 // and default updates, so they render in the same batch. The only reason
262264 // they use separate lanes is because continuous updates should interrupt
263265 // transitions, but default updates should not.
@@ -459,17 +461,21 @@ export function shouldTimeSlice(root: FiberRoot, lanes: Lanes) {
459461 // finish rendering without yielding execution.
460462 return false ;
461463 }
462- if ( enableSyncDefaultUpdates ) {
463- const SyncDefaultLanes =
464- InputContinuousHydrationLane |
465- InputContinuousLane |
466- DefaultHydrationLane |
467- DefaultLane ;
468- // TODO: Check for root override, once that lands
469- return ( lanes & SyncDefaultLanes ) === NoLanes ;
470- } else {
464+
465+ if (
466+ allowConcurrentByDefault &&
467+ ( root . current . mode & ConcurrentUpdatesByDefaultMode ) !== NoMode
468+ ) {
469+ // Concurrent updates by default always use time slicing.
471470 return true ;
472471 }
472+
473+ const SyncDefaultLanes =
474+ InputContinuousHydrationLane |
475+ InputContinuousLane |
476+ DefaultHydrationLane |
477+ DefaultLane ;
478+ return ( lanes & SyncDefaultLanes ) === NoLanes ;
473479}
474480
475481export function isTransitionLane ( lane : Lane ) {
0 commit comments