7
7
* @noflow
8
8
* @nolint
9
9
* @preventMunge
10
- * @generated SignedSource<<491e433a3e81760180afd88ca49b58ec >>
10
+ * @generated SignedSource<<1aed0b993a4c164c11bd44255ec4ddac >>
11
11
*/
12
12
13
13
"use strict";
@@ -1728,7 +1728,7 @@ if (__DEV__) {
1728
1728
1729
1729
return laneMap;
1730
1730
}
1731
- function markRootUpdated(root, updateLane) {
1731
+ function markRootUpdated$1 (root, updateLane) {
1732
1732
root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update
1733
1733
// could unblock them. Clear the suspended lanes so that we can try rendering
1734
1734
// them again.
@@ -1765,7 +1765,7 @@ if (__DEV__) {
1765
1765
markSpawnedDeferredLane(root, spawnedLane, suspendedLanes);
1766
1766
}
1767
1767
}
1768
- function markRootPinged(root, pingedLanes) {
1768
+ function markRootPinged$1 (root, pingedLanes) {
1769
1769
root.pingedLanes |= root.suspendedLanes & pingedLanes;
1770
1770
}
1771
1771
function markRootFinished(root, remainingLanes, spawnedLane) {
@@ -21608,7 +21608,9 @@ if (__DEV__) {
21608
21608
var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI.
21609
21609
// We will log them once the tree commits.
21610
21610
21611
- var workInProgressRootRecoverableErrors = null; // The most recent time we either committed a fallback, or when a fallback was
21611
+ var workInProgressRootRecoverableErrors = null; // Tracks when an update occurs during the render phase.
21612
+
21613
+ var workInProgressRootDidIncludeRecursiveRenderUpdate = false; // Thacks when an update occurs during the commit phase. It's a separate
21612
21614
// filled in with the resolved UI. This lets us throttle the appearance of new
21613
21615
// content as it streams in, to minimize jank.
21614
21616
// TODO: Think of a better name for this variable?
@@ -22118,6 +22120,7 @@ if (__DEV__) {
22118
22120
root,
22119
22121
workInProgressRootRecoverableErrors,
22120
22122
workInProgressTransitions,
22123
+ workInProgressRootDidIncludeRecursiveRenderUpdate,
22121
22124
workInProgressDeferredLane
22122
22125
);
22123
22126
} else {
@@ -22148,6 +22151,7 @@ if (__DEV__) {
22148
22151
finishedWork,
22149
22152
workInProgressRootRecoverableErrors,
22150
22153
workInProgressTransitions,
22154
+ workInProgressRootDidIncludeRecursiveRenderUpdate,
22151
22155
lanes,
22152
22156
workInProgressDeferredLane
22153
22157
),
@@ -22162,6 +22166,7 @@ if (__DEV__) {
22162
22166
finishedWork,
22163
22167
workInProgressRootRecoverableErrors,
22164
22168
workInProgressTransitions,
22169
+ workInProgressRootDidIncludeRecursiveRenderUpdate,
22165
22170
lanes,
22166
22171
workInProgressDeferredLane
22167
22172
);
@@ -22173,6 +22178,7 @@ if (__DEV__) {
22173
22178
finishedWork,
22174
22179
recoverableErrors,
22175
22180
transitions,
22181
+ didIncludeRenderPhaseUpdate,
22176
22182
lanes,
22177
22183
spawnedLane
22178
22184
) {
@@ -22197,14 +22203,26 @@ if (__DEV__) {
22197
22203
// us that it's ready. This will be canceled if we start work on the
22198
22204
// root again.
22199
22205
root.cancelPendingCommit = schedulePendingCommit(
22200
- commitRoot.bind(null, root, recoverableErrors, transitions)
22206
+ commitRoot.bind(
22207
+ null,
22208
+ root,
22209
+ recoverableErrors,
22210
+ transitions,
22211
+ didIncludeRenderPhaseUpdate
22212
+ )
22201
22213
);
22202
22214
markRootSuspended(root, lanes, spawnedLane);
22203
22215
return;
22204
22216
}
22205
22217
} // Otherwise, commit immediately.
22206
22218
22207
- commitRoot(root, recoverableErrors, transitions, spawnedLane);
22219
+ commitRoot(
22220
+ root,
22221
+ recoverableErrors,
22222
+ transitions,
22223
+ didIncludeRenderPhaseUpdate,
22224
+ spawnedLane
22225
+ );
22208
22226
}
22209
22227
22210
22228
function isRenderConsistentWithExternalStores(finishedWork) {
@@ -22267,13 +22285,23 @@ if (__DEV__) {
22267
22285
// eslint-disable-next-line no-unreachable
22268
22286
22269
22287
return true;
22288
+ } // The extra indirections around markRootUpdated and markRootSuspended is
22289
+ // needed to avoid a circular dependency between this module and
22290
+ // ReactFiberLane. There's probably a better way to split up these modules and
22291
+ // avoid this problem. Perhaps all the root-marking functions should move into
22292
+ // the work loop.
22293
+
22294
+ function markRootUpdated(root, updatedLanes) {
22295
+ markRootUpdated$1(root, updatedLanes);
22296
+ }
22297
+
22298
+ function markRootPinged(root, pingedLanes) {
22299
+ markRootPinged$1(root, pingedLanes);
22270
22300
}
22271
22301
22272
22302
function markRootSuspended(root, suspendedLanes, spawnedLane) {
22273
22303
// When suspending, we should always exclude lanes that were pinged or (more
22274
22304
// rarely, since we try to avoid it) updated during the render phase.
22275
- // TODO: Lol maybe there's a better way to factor this besides this
22276
- // obnoxiously named function :)
22277
22305
suspendedLanes = removeLanes(
22278
22306
suspendedLanes,
22279
22307
workInProgressRootPingedLanes
@@ -22282,6 +22310,7 @@ if (__DEV__) {
22282
22310
suspendedLanes,
22283
22311
workInProgressRootInterleavedUpdatedLanes
22284
22312
);
22313
+
22285
22314
markRootSuspended$1(root, suspendedLanes, spawnedLane);
22286
22315
} // This is the entry point for synchronous tasks that don't go
22287
22316
// through Scheduler
@@ -22356,6 +22385,7 @@ if (__DEV__) {
22356
22385
root,
22357
22386
workInProgressRootRecoverableErrors,
22358
22387
workInProgressTransitions,
22388
+ workInProgressRootDidIncludeRecursiveRenderUpdate,
22359
22389
workInProgressDeferredLane
22360
22390
); // Before exiting, make sure there's a callback scheduled for the next
22361
22391
// pending level.
@@ -22500,7 +22530,8 @@ if (__DEV__) {
22500
22530
workInProgressRootPingedLanes = NoLanes;
22501
22531
workInProgressDeferredLane = NoLane;
22502
22532
workInProgressRootConcurrentErrors = null;
22503
- workInProgressRootRecoverableErrors = null; // Get the lanes that are entangled with whatever we're about to render. We
22533
+ workInProgressRootRecoverableErrors = null;
22534
+ workInProgressRootDidIncludeRecursiveRenderUpdate = false; // Get the lanes that are entangled with whatever we're about to render. We
22504
22535
// track these separately so we can distinguish the priority of the render
22505
22536
// task from the priority of the lanes it is entangled with. For example, a
22506
22537
// transition may not be allowed to finish unless it includes the Sync lane,
@@ -23450,7 +23481,13 @@ if (__DEV__) {
23450
23481
workInProgress = null;
23451
23482
}
23452
23483
23453
- function commitRoot(root, recoverableErrors, transitions, spawnedLane) {
23484
+ function commitRoot(
23485
+ root,
23486
+ recoverableErrors,
23487
+ transitions,
23488
+ didIncludeRenderPhaseUpdate,
23489
+ spawnedLane
23490
+ ) {
23454
23491
// TODO: This no longer makes any sense. We already wrap the mutation and
23455
23492
// layout phases. Should be able to remove.
23456
23493
var previousUpdateLanePriority = getCurrentUpdatePriority();
@@ -23463,6 +23500,7 @@ if (__DEV__) {
23463
23500
root,
23464
23501
recoverableErrors,
23465
23502
transitions,
23503
+ didIncludeRenderPhaseUpdate,
23466
23504
previousUpdateLanePriority,
23467
23505
spawnedLane
23468
23506
);
@@ -23478,6 +23516,7 @@ if (__DEV__) {
23478
23516
root,
23479
23517
recoverableErrors,
23480
23518
transitions,
23519
+ didIncludeRenderPhaseUpdate,
23481
23520
renderPriorityLevel,
23482
23521
spawnedLane
23483
23522
) {
@@ -23537,7 +23576,7 @@ if (__DEV__) {
23537
23576
23538
23577
var concurrentlyUpdatedLanes = getConcurrentlyUpdatedLanes();
23539
23578
remainingLanes = mergeLanes(remainingLanes, concurrentlyUpdatedLanes);
23540
- markRootFinished(root, remainingLanes, spawnedLane);
23579
+ markRootFinished(root, remainingLanes, spawnedLane); // Reset this before firing side effects so we can detect recursive updates.
23541
23580
23542
23581
if (root === workInProgressRoot) {
23543
23582
// We can reset these now that they are finished.
@@ -23725,6 +23764,9 @@ if (__DEV__) {
23725
23764
// hydration is conceptually not an update.
23726
23765
23727
23766
if (
23767
+ // Check if there was a recursive update spawned by this render, in either
23768
+ // the render phase or the commit phase. We track these explicitly because
23769
+ // we can't infer from the remaining lanes alone.
23728
23770
// Was the finished render the result of an update (not hydration)?
23729
23771
includesSomeLane(lanes, UpdateLanes) && // Did it schedule a sync update?
23730
23772
includesSomeLane(remainingLanes, SyncUpdateLanes)
@@ -24172,6 +24214,7 @@ if (__DEV__) {
24172
24214
nestedPassiveUpdateCount = 0;
24173
24215
rootWithNestedUpdates = null;
24174
24216
rootWithPassiveNestedUpdates = null;
24217
+
24175
24218
throw new Error(
24176
24219
"Maximum update depth exceeded. This can happen when a component " +
24177
24220
"repeatedly calls setState inside componentWillUpdate or " +
@@ -25678,7 +25721,7 @@ if (__DEV__) {
25678
25721
return root;
25679
25722
}
25680
25723
25681
- var ReactVersion = "18.3.0-canary-03d6f7cf0 -20240209";
25724
+ var ReactVersion = "18.3.0-canary-d8c1fa6b0 -20240209";
25682
25725
25683
25726
// Might add PROFILE later.
25684
25727
0 commit comments