@@ -141,9 +141,9 @@ import {
141
141
includesExpiredLane ,
142
142
getNextLanes ,
143
143
getLanesToRetrySynchronouslyOnError ,
144
- markRootSuspended as _markRootSuspended ,
145
- markRootUpdated as _markRootUpdated ,
146
- markRootPinged as _markRootPinged ,
144
+ markRootUpdated ,
145
+ markRootSuspended as markRootSuspended_dontCallThisOneDirectly ,
146
+ markRootPinged ,
147
147
markRootEntangled ,
148
148
markRootFinished ,
149
149
addFiberToLanesMap ,
@@ -370,13 +370,6 @@ let workInProgressRootConcurrentErrors: Array<CapturedValue<mixed>> | null =
370
370
let workInProgressRootRecoverableErrors : Array < CapturedValue < mixed >> | null =
371
371
null ;
372
372
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
-
380
373
// The most recent time we either committed a fallback, or when a fallback was
381
374
// filled in with the resolved UI. This lets us throttle the appearance of new
382
375
// content as it streams in, to minimize jank.
@@ -1121,7 +1114,6 @@ function finishConcurrentRender(
1121
1114
root ,
1122
1115
workInProgressRootRecoverableErrors ,
1123
1116
workInProgressTransitions ,
1124
- workInProgressRootDidIncludeRecursiveRenderUpdate ,
1125
1117
) ;
1126
1118
} else {
1127
1119
if (
@@ -1156,7 +1148,6 @@ function finishConcurrentRender(
1156
1148
finishedWork ,
1157
1149
workInProgressRootRecoverableErrors ,
1158
1150
workInProgressTransitions ,
1159
- workInProgressRootDidIncludeRecursiveRenderUpdate ,
1160
1151
lanes ,
1161
1152
) ,
1162
1153
msUntilTimeout ,
@@ -1169,7 +1160,6 @@ function finishConcurrentRender(
1169
1160
finishedWork ,
1170
1161
workInProgressRootRecoverableErrors ,
1171
1162
workInProgressTransitions ,
1172
- workInProgressRootDidIncludeRecursiveRenderUpdate ,
1173
1163
lanes ,
1174
1164
) ;
1175
1165
}
@@ -1180,7 +1170,6 @@ function commitRootWhenReady(
1180
1170
finishedWork : Fiber ,
1181
1171
recoverableErrors : Array < CapturedValue < mixed >> | null ,
1182
1172
transitions : Array < Transition > | null ,
1183
- didIncludeRenderPhaseUpdate : boolean ,
1184
1173
lanes : Lanes ,
1185
1174
) {
1186
1175
// TODO: Combine retry throttling with Suspensey commits. Right now they run
@@ -1207,21 +1196,15 @@ function commitRootWhenReady(
1207
1196
// us that it's ready. This will be canceled if we start work on the
1208
1197
// root again.
1209
1198
root . cancelPendingCommit = schedulePendingCommit (
1210
- commitRoot . bind (
1211
- null ,
1212
- root ,
1213
- recoverableErrors ,
1214
- transitions ,
1215
- didIncludeRenderPhaseUpdate ,
1216
- ) ,
1199
+ commitRoot . bind ( null , root , recoverableErrors , transitions ) ,
1217
1200
) ;
1218
1201
markRootSuspended ( root , lanes ) ;
1219
1202
return ;
1220
1203
}
1221
1204
}
1222
1205
1223
1206
// Otherwise, commit immediately.
1224
- commitRoot ( root , recoverableErrors , transitions , didIncludeRenderPhaseUpdate ) ;
1207
+ commitRoot ( root , recoverableErrors , transitions ) ;
1225
1208
}
1226
1209
1227
1210
function isRenderConsistentWithExternalStores ( finishedWork : Fiber ) : boolean {
@@ -1277,51 +1260,17 @@ function isRenderConsistentWithExternalStores(finishedWork: Fiber): boolean {
1277
1260
return true ;
1278
1261
}
1279
1262
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
-
1316
1263
function markRootSuspended ( root : FiberRoot , suspendedLanes : Lanes ) {
1317
1264
// When suspending, we should always exclude lanes that were pinged or (more
1318
1265
// 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 :)
1319
1268
suspendedLanes = removeLanes ( suspendedLanes , workInProgressRootPingedLanes ) ;
1320
1269
suspendedLanes = removeLanes (
1321
1270
suspendedLanes ,
1322
1271
workInProgressRootInterleavedUpdatedLanes ,
1323
1272
) ;
1324
- _markRootSuspended ( root , suspendedLanes ) ;
1273
+ markRootSuspended_dontCallThisOneDirectly ( root , suspendedLanes ) ;
1325
1274
}
1326
1275
1327
1276
// This is the entry point for synchronous tasks that don't go
@@ -1392,7 +1341,6 @@ export function performSyncWorkOnRoot(root: FiberRoot): null {
1392
1341
root ,
1393
1342
workInProgressRootRecoverableErrors ,
1394
1343
workInProgressTransitions ,
1395
- workInProgressRootDidIncludeRecursiveRenderUpdate ,
1396
1344
) ;
1397
1345
1398
1346
// Before exiting, make sure there's a callback scheduled for the next
@@ -1607,7 +1555,6 @@ function prepareFreshStack(root: FiberRoot, lanes: Lanes): Fiber {
1607
1555
workInProgressRootPingedLanes = NoLanes ;
1608
1556
workInProgressRootConcurrentErrors = null ;
1609
1557
workInProgressRootRecoverableErrors = null ;
1610
- workInProgressRootDidIncludeRecursiveRenderUpdate = false ;
1611
1558
1612
1559
finishQueueingConcurrentUpdates ( ) ;
1613
1560
@@ -2649,7 +2596,6 @@ function commitRoot(
2649
2596
root : FiberRoot ,
2650
2597
recoverableErrors : null | Array < CapturedValue < mixed >> ,
2651
2598
transitions : Array < Transition > | null ,
2652
- didIncludeRenderPhaseUpdate : boolean ,
2653
2599
) {
2654
2600
// TODO: This no longer makes any sense. We already wrap the mutation and
2655
2601
// layout phases. Should be able to remove.
@@ -2663,7 +2609,6 @@ function commitRoot(
2663
2609
root ,
2664
2610
recoverableErrors ,
2665
2611
transitions ,
2666
- didIncludeRenderPhaseUpdate ,
2667
2612
previousUpdateLanePriority ,
2668
2613
) ;
2669
2614
} finally {
@@ -2678,7 +2623,6 @@ function commitRootImpl(
2678
2623
root : FiberRoot ,
2679
2624
recoverableErrors : null | Array < CapturedValue < mixed >> ,
2680
2625
transitions : Array < Transition > | null ,
2681
- didIncludeRenderPhaseUpdate : boolean ,
2682
2626
renderPriorityLevel : EventPriority ,
2683
2627
) {
2684
2628
do {
@@ -2758,9 +2702,6 @@ function commitRootImpl(
2758
2702
2759
2703
markRootFinished ( root , remainingLanes ) ;
2760
2704
2761
- // Reset this before firing side effects so we can detect recursive updates.
2762
- didIncludeCommitPhaseUpdate = false ;
2763
-
2764
2705
if ( root === workInProgressRoot ) {
2765
2706
// We can reset these now that they are finished.
2766
2707
workInProgressRoot = null ;
@@ -3007,19 +2948,7 @@ function commitRootImpl(
3007
2948
3008
2949
// Read this again, since a passive effect might have updated it
3009
2950
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 ) ) {
3023
2952
if ( enableProfilerTimer && enableProfilerNestedUpdatePhase ) {
3024
2953
markNestedUpdateScheduled ( ) ;
3025
2954
}
@@ -3561,17 +3490,6 @@ export function throwIfInfiniteUpdateLoopDetected() {
3561
3490
rootWithNestedUpdates = null ;
3562
3491
rootWithPassiveNestedUpdates = null ;
3563
3492
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
-
3575
3493
throw new Error (
3576
3494
'Maximum update depth exceeded. This can happen when a component ' +
3577
3495
'repeatedly calls setState inside componentWillUpdate or ' +
0 commit comments