@@ -141,9 +141,9 @@ import {
141141 includesExpiredLane ,
142142 getNextLanes ,
143143 getLanesToRetrySynchronouslyOnError ,
144- markRootSuspended as _markRootSuspended ,
145- markRootUpdated as _markRootUpdated ,
146- markRootPinged as _markRootPinged ,
144+ markRootUpdated ,
145+ markRootSuspended as markRootSuspended_dontCallThisOneDirectly ,
146+ markRootPinged ,
147147 markRootEntangled ,
148148 markRootFinished ,
149149 addFiberToLanesMap ,
@@ -370,13 +370,6 @@ let workInProgressRootConcurrentErrors: Array<CapturedValue<mixed>> | null =
370370let workInProgressRootRecoverableErrors : Array < CapturedValue < mixed >> | null =
371371 null ;
372372
373- // Tracks when an update occurs during the render phase.
374- let workInProgressRootDidIncludeRecursiveRenderUpdate : boolean = false ;
375- // Thacks when an update occurs during the commit phase. It's a separate
376- // variable from the one for renders because the commit phase may run
377- // concurrently to a render phase.
378- let didIncludeCommitPhaseUpdate : boolean = false ;
379-
380373// The most recent time we either committed a fallback, or when a fallback was
381374// filled in with the resolved UI. This lets us throttle the appearance of new
382375// content as it streams in, to minimize jank.
@@ -1121,7 +1114,6 @@ function finishConcurrentRender(
11211114 root ,
11221115 workInProgressRootRecoverableErrors ,
11231116 workInProgressTransitions ,
1124- workInProgressRootDidIncludeRecursiveRenderUpdate ,
11251117 ) ;
11261118 } else {
11271119 if (
@@ -1156,7 +1148,6 @@ function finishConcurrentRender(
11561148 finishedWork ,
11571149 workInProgressRootRecoverableErrors ,
11581150 workInProgressTransitions ,
1159- workInProgressRootDidIncludeRecursiveRenderUpdate ,
11601151 lanes ,
11611152 ) ,
11621153 msUntilTimeout ,
@@ -1169,7 +1160,6 @@ function finishConcurrentRender(
11691160 finishedWork ,
11701161 workInProgressRootRecoverableErrors ,
11711162 workInProgressTransitions ,
1172- workInProgressRootDidIncludeRecursiveRenderUpdate ,
11731163 lanes ,
11741164 ) ;
11751165 }
@@ -1180,7 +1170,6 @@ function commitRootWhenReady(
11801170 finishedWork : Fiber ,
11811171 recoverableErrors : Array < CapturedValue < mixed >> | null ,
11821172 transitions : Array < Transition > | null ,
1183- didIncludeRenderPhaseUpdate : boolean ,
11841173 lanes : Lanes ,
11851174) {
11861175 // TODO: Combine retry throttling with Suspensey commits. Right now they run
@@ -1207,21 +1196,15 @@ function commitRootWhenReady(
12071196 // us that it's ready. This will be canceled if we start work on the
12081197 // root again.
12091198 root . cancelPendingCommit = schedulePendingCommit (
1210- commitRoot . bind (
1211- null ,
1212- root ,
1213- recoverableErrors ,
1214- transitions ,
1215- didIncludeRenderPhaseUpdate ,
1216- ) ,
1199+ commitRoot . bind ( null , root , recoverableErrors , transitions ) ,
12171200 ) ;
12181201 markRootSuspended ( root , lanes ) ;
12191202 return ;
12201203 }
12211204 }
12221205
12231206 // Otherwise, commit immediately.
1224- commitRoot ( root , recoverableErrors , transitions , didIncludeRenderPhaseUpdate ) ;
1207+ commitRoot ( root , recoverableErrors , transitions ) ;
12251208}
12261209
12271210function isRenderConsistentWithExternalStores ( finishedWork : Fiber ) : boolean {
@@ -1277,51 +1260,17 @@ function isRenderConsistentWithExternalStores(finishedWork: Fiber): boolean {
12771260 return true ;
12781261}
12791262
1280- // The extra indirections around markRootUpdated and markRootSuspended is
1281- // needed to avoid a circular dependency between this module and
1282- // ReactFiberLane. There's probably a better way to split up these modules and
1283- // avoid this problem. Perhaps all the root-marking functions should move into
1284- // the work loop.
1285-
1286- function markRootUpdated ( root : FiberRoot , updatedLanes : Lanes ) {
1287- _markRootUpdated ( root , updatedLanes ) ;
1288-
1289- // Check for recursive updates
1290- if ( executionContext & RenderContext ) {
1291- workInProgressRootDidIncludeRecursiveRenderUpdate = true ;
1292- } else if ( executionContext & CommitContext ) {
1293- didIncludeCommitPhaseUpdate = true ;
1294- }
1295-
1296- throwIfInfiniteUpdateLoopDetected ( ) ;
1297- }
1298-
1299- function markRootPinged ( root : FiberRoot , pingedLanes : Lanes ) {
1300- _markRootPinged ( root , pingedLanes ) ;
1301-
1302- // Check for recursive pings. Pings are conceptually different from updates in
1303- // other contexts but we call it an "update" in this context because
1304- // repeatedly pinging a suspended render can cause a recursive render loop.
1305- // The relevant property is that it can result in a new render attempt
1306- // being scheduled.
1307- if ( executionContext & RenderContext ) {
1308- workInProgressRootDidIncludeRecursiveRenderUpdate = true ;
1309- } else if ( executionContext & CommitContext ) {
1310- didIncludeCommitPhaseUpdate = true ;
1311- }
1312-
1313- throwIfInfiniteUpdateLoopDetected ( ) ;
1314- }
1315-
13161263function markRootSuspended ( root : FiberRoot , suspendedLanes : Lanes ) {
13171264 // When suspending, we should always exclude lanes that were pinged or (more
13181265 // rarely, since we try to avoid it) updated during the render phase.
1266+ // TODO: Lol maybe there's a better way to factor this besides this
1267+ // obnoxiously named function :)
13191268 suspendedLanes = removeLanes ( suspendedLanes , workInProgressRootPingedLanes ) ;
13201269 suspendedLanes = removeLanes (
13211270 suspendedLanes ,
13221271 workInProgressRootInterleavedUpdatedLanes ,
13231272 ) ;
1324- _markRootSuspended ( root , suspendedLanes ) ;
1273+ markRootSuspended_dontCallThisOneDirectly ( root , suspendedLanes ) ;
13251274}
13261275
13271276// This is the entry point for synchronous tasks that don't go
@@ -1392,7 +1341,6 @@ export function performSyncWorkOnRoot(root: FiberRoot): null {
13921341 root ,
13931342 workInProgressRootRecoverableErrors ,
13941343 workInProgressTransitions ,
1395- workInProgressRootDidIncludeRecursiveRenderUpdate ,
13961344 ) ;
13971345
13981346 // Before exiting, make sure there's a callback scheduled for the next
@@ -1607,7 +1555,6 @@ function prepareFreshStack(root: FiberRoot, lanes: Lanes): Fiber {
16071555 workInProgressRootPingedLanes = NoLanes ;
16081556 workInProgressRootConcurrentErrors = null ;
16091557 workInProgressRootRecoverableErrors = null ;
1610- workInProgressRootDidIncludeRecursiveRenderUpdate = false ;
16111558
16121559 finishQueueingConcurrentUpdates ( ) ;
16131560
@@ -2649,7 +2596,6 @@ function commitRoot(
26492596 root : FiberRoot ,
26502597 recoverableErrors : null | Array < CapturedValue < mixed >> ,
26512598 transitions : Array < Transition > | null ,
2652- didIncludeRenderPhaseUpdate : boolean ,
26532599) {
26542600 // TODO: This no longer makes any sense. We already wrap the mutation and
26552601 // layout phases. Should be able to remove.
@@ -2663,7 +2609,6 @@ function commitRoot(
26632609 root ,
26642610 recoverableErrors ,
26652611 transitions ,
2666- didIncludeRenderPhaseUpdate ,
26672612 previousUpdateLanePriority ,
26682613 ) ;
26692614 } finally {
@@ -2678,7 +2623,6 @@ function commitRootImpl(
26782623 root : FiberRoot ,
26792624 recoverableErrors : null | Array < CapturedValue < mixed >> ,
26802625 transitions : Array < Transition > | null ,
2681- didIncludeRenderPhaseUpdate : boolean ,
26822626 renderPriorityLevel : EventPriority ,
26832627) {
26842628 do {
@@ -2758,9 +2702,6 @@ function commitRootImpl(
27582702
27592703 markRootFinished ( root , remainingLanes ) ;
27602704
2761- // Reset this before firing side effects so we can detect recursive updates.
2762- didIncludeCommitPhaseUpdate = false ;
2763-
27642705 if ( root === workInProgressRoot ) {
27652706 // We can reset these now that they are finished.
27662707 workInProgressRoot = null ;
@@ -3007,19 +2948,7 @@ function commitRootImpl(
30072948
30082949 // Read this again, since a passive effect might have updated it
30092950 remainingLanes = root . pendingLanes ;
3010- if (
3011- // Check if there was a recursive update spawned by this render, in either
3012- // the render phase or the commit phase. We track these explicitly because
3013- // we can't infer from the remaining lanes alone.
3014- didIncludeCommitPhaseUpdate ||
3015- didIncludeRenderPhaseUpdate ||
3016- // As an additional precaution, we also check if there's any remaining sync
3017- // work. Theoretically this should be unreachable but if there's a mistake
3018- // in React it helps to be overly defensive given how hard it is to debug
3019- // those scenarios otherwise. This won't catch recursive async updates,
3020- // though, which is why we check the flags above first.
3021- includesSyncLane ( remainingLanes )
3022- ) {
2951+ if ( includesSyncLane ( remainingLanes ) ) {
30232952 if ( enableProfilerTimer && enableProfilerNestedUpdatePhase ) {
30242953 markNestedUpdateScheduled ( ) ;
30252954 }
@@ -3561,17 +3490,6 @@ export function throwIfInfiniteUpdateLoopDetected() {
35613490 rootWithNestedUpdates = null ;
35623491 rootWithPassiveNestedUpdates = null ;
35633492
3564- if ( executionContext & RenderContext && workInProgressRoot !== null ) {
3565- // We're in the render phase. Disable the concurrent error recovery
3566- // mechanism to ensure that the error we're about to throw gets handled.
3567- // We need it to trigger the nearest error boundary so that the infinite
3568- // update loop is broken.
3569- workInProgressRoot . errorRecoveryDisabledLanes = mergeLanes (
3570- workInProgressRoot . errorRecoveryDisabledLanes ,
3571- workInProgressRootRenderLanes ,
3572- ) ;
3573- }
3574-
35753493 throw new Error (
35763494 'Maximum update depth exceeded. This can happen when a component ' +
35773495 'repeatedly calls setState inside componentWillUpdate or ' +
0 commit comments