7
7
* @noflow
8
8
* @nolint
9
9
* @preventMunge
10
- * @generated SignedSource<<b3edba4ee6aa87997395f161d846a4b0 >>
10
+ * @generated SignedSource<<adf921170475fb87731c699acf7c0c8f >>
11
11
*/
12
12
13
13
'use strict';
@@ -1584,7 +1584,7 @@ function createLaneMap(initial) {
1584
1584
1585
1585
return laneMap;
1586
1586
}
1587
- function markRootUpdated$1 (root, updateLane) {
1587
+ function markRootUpdated(root, updateLane) {
1588
1588
root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update
1589
1589
// could unblock them. Clear the suspended lanes so that we can try rendering
1590
1590
// them again.
@@ -1617,7 +1617,7 @@ function markRootSuspended$1(root, suspendedLanes) {
1617
1617
lanes &= ~lane;
1618
1618
}
1619
1619
}
1620
- function markRootPinged$1 (root, pingedLanes) {
1620
+ function markRootPinged(root, pingedLanes) {
1621
1621
root.pingedLanes |= root.suspendedLanes & pingedLanes;
1622
1622
}
1623
1623
function markRootFinished(root, remainingLanes) {
@@ -6031,21 +6031,6 @@ function ensureRootIsScheduled(root) {
6031
6031
ReactCurrentActQueue$2.didScheduleLegacyUpdate = true;
6032
6032
}
6033
6033
}
6034
-
6035
- function unscheduleAllRoots() {
6036
- // This is only done in a fatal error situation, as a last resort to prevent
6037
- // an infinite render loop.
6038
- var root = firstScheduledRoot;
6039
-
6040
- while (root !== null) {
6041
- var next = root.next;
6042
- root.next = null;
6043
- root = next;
6044
- }
6045
-
6046
- firstScheduledRoot = lastScheduledRoot = null;
6047
- }
6048
-
6049
6034
function flushSyncWorkOnAllRoots() {
6050
6035
// This is allowed to be called synchronously, but the caller should check
6051
6036
// the execution context first.
@@ -6074,49 +6059,11 @@ function flushSyncWorkAcrossRoots_impl(onlyLegacy) {
6074
6059
var workInProgressRootRenderLanes = getWorkInProgressRootRenderLanes(); // There may or may not be synchronous work scheduled. Let's check.
6075
6060
6076
6061
var didPerformSomeWork;
6077
- var nestedUpdatePasses = 0;
6078
6062
var errors = null;
6079
6063
isFlushingWork = true;
6080
6064
6081
6065
do {
6082
- didPerformSomeWork = false; // This outer loop re-runs if performing sync work on a root spawns
6083
- // additional sync work. If it happens too many times, it's very likely
6084
- // caused by some sort of infinite update loop. We already have a loop guard
6085
- // in place that will trigger an error on the n+1th update, but it's
6086
- // possible for that error to get swallowed if the setState is called from
6087
- // an unexpected place, like during the render phase. So as an added
6088
- // precaution, we also use a guard here.
6089
- //
6090
- // Ideally, there should be no known way to trigger this synchronous loop.
6091
- // It's really just here as a safety net.
6092
- //
6093
- // This limit is slightly larger than the one that throws inside setState,
6094
- // because that one is preferable because it includes a componens stack.
6095
-
6096
- if (++nestedUpdatePasses > 60) {
6097
- // This is a fatal error, so we'll unschedule all the roots.
6098
- unscheduleAllRoots(); // TODO: Change this error message to something different to distinguish
6099
- // it from the one that is thrown from setState. Those are less fatal
6100
- // because they usually will result in the bad component being unmounted,
6101
- // and an error boundary being triggered, rather than us having to
6102
- // forcibly stop the entire scheduler.
6103
-
6104
- var infiniteUpdateError = new Error(
6105
- "Maximum update depth exceeded. This can happen when a component " +
6106
- "repeatedly calls setState inside componentWillUpdate or " +
6107
- "componentDidUpdate. React limits the number of nested updates to " +
6108
- "prevent infinite loops."
6109
- );
6110
-
6111
- if (errors === null) {
6112
- errors = [infiniteUpdateError];
6113
- } else {
6114
- errors.push(infiniteUpdateError);
6115
- }
6116
-
6117
- break;
6118
- }
6119
-
6066
+ didPerformSomeWork = false;
6120
6067
var root = firstScheduledRoot;
6121
6068
6122
6069
while (root !== null) {
@@ -20018,13 +19965,7 @@ var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during th
20018
19965
var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI.
20019
19966
// We will log them once the tree commits.
20020
19967
20021
- var workInProgressRootRecoverableErrors = null; // Tracks when an update occurs during the render phase.
20022
-
20023
- var workInProgressRootDidIncludeRecursiveRenderUpdate = false; // Thacks when an update occurs during the commit phase. It's a separate
20024
- // variable from the one for renders because the commit phase may run
20025
- // concurrently to a render phase.
20026
-
20027
- var didIncludeCommitPhaseUpdate = false; // The most recent time we either committed a fallback, or when a fallback was
19968
+ var workInProgressRootRecoverableErrors = null; // The most recent time we either committed a fallback, or when a fallback was
20028
19969
// filled in with the resolved UI. This lets us throttle the appearance of new
20029
19970
// content as it streams in, to minimize jank.
20030
19971
// TODO: Think of a better name for this variable?
@@ -20506,8 +20447,7 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) {
20506
20447
commitRoot(
20507
20448
root,
20508
20449
workInProgressRootRecoverableErrors,
20509
- workInProgressTransitions,
20510
- workInProgressRootDidIncludeRecursiveRenderUpdate
20450
+ workInProgressTransitions
20511
20451
);
20512
20452
} else {
20513
20453
if (includesOnlyRetries(lanes) && alwaysThrottleRetries) {
@@ -20537,7 +20477,6 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) {
20537
20477
finishedWork,
20538
20478
workInProgressRootRecoverableErrors,
20539
20479
workInProgressTransitions,
20540
- workInProgressRootDidIncludeRecursiveRenderUpdate,
20541
20480
lanes
20542
20481
),
20543
20482
msUntilTimeout
@@ -20551,7 +20490,6 @@ function finishConcurrentRender(root, exitStatus, finishedWork, lanes) {
20551
20490
finishedWork,
20552
20491
workInProgressRootRecoverableErrors,
20553
20492
workInProgressTransitions,
20554
- workInProgressRootDidIncludeRecursiveRenderUpdate,
20555
20493
lanes
20556
20494
);
20557
20495
}
@@ -20562,7 +20500,6 @@ function commitRootWhenReady(
20562
20500
finishedWork,
20563
20501
recoverableErrors,
20564
20502
transitions,
20565
- didIncludeRenderPhaseUpdate,
20566
20503
lanes
20567
20504
) {
20568
20505
// TODO: Combine retry throttling with Suspensey commits. Right now they run
@@ -20586,20 +20523,14 @@ function commitRootWhenReady(
20586
20523
// us that it's ready. This will be canceled if we start work on the
20587
20524
// root again.
20588
20525
root.cancelPendingCommit = schedulePendingCommit(
20589
- commitRoot.bind(
20590
- null,
20591
- root,
20592
- recoverableErrors,
20593
- transitions,
20594
- didIncludeRenderPhaseUpdate
20595
- )
20526
+ commitRoot.bind(null, root, recoverableErrors, transitions)
20596
20527
);
20597
20528
markRootSuspended(root, lanes);
20598
20529
return;
20599
20530
}
20600
20531
} // Otherwise, commit immediately.
20601
20532
20602
- commitRoot(root, recoverableErrors, transitions, didIncludeRenderPhaseUpdate );
20533
+ commitRoot(root, recoverableErrors, transitions);
20603
20534
}
20604
20535
20605
20536
function isRenderConsistentWithExternalStores(finishedWork) {
@@ -20662,49 +20593,18 @@ function isRenderConsistentWithExternalStores(finishedWork) {
20662
20593
// eslint-disable-next-line no-unreachable
20663
20594
20664
20595
return true;
20665
- } // The extra indirections around markRootUpdated and markRootSuspended is
20666
- // needed to avoid a circular dependency between this module and
20667
- // ReactFiberLane. There's probably a better way to split up these modules and
20668
- // avoid this problem. Perhaps all the root-marking functions should move into
20669
- // the work loop.
20670
-
20671
- function markRootUpdated(root, updatedLanes) {
20672
- markRootUpdated$1(root, updatedLanes); // Check for recursive updates
20673
-
20674
- if (executionContext & RenderContext) {
20675
- workInProgressRootDidIncludeRecursiveRenderUpdate = true;
20676
- } else if (executionContext & CommitContext) {
20677
- didIncludeCommitPhaseUpdate = true;
20678
- }
20679
-
20680
- throwIfInfiniteUpdateLoopDetected();
20681
- }
20682
-
20683
- function markRootPinged(root, pingedLanes) {
20684
- markRootPinged$1(root, pingedLanes); // Check for recursive pings. Pings are conceptually different from updates in
20685
- // other contexts but we call it an "update" in this context because
20686
- // repeatedly pinging a suspended render can cause a recursive render loop.
20687
- // The relevant property is that it can result in a new render attempt
20688
- // being scheduled.
20689
-
20690
- if (executionContext & RenderContext) {
20691
- workInProgressRootDidIncludeRecursiveRenderUpdate = true;
20692
- } else if (executionContext & CommitContext) {
20693
- didIncludeCommitPhaseUpdate = true;
20694
- }
20695
-
20696
- throwIfInfiniteUpdateLoopDetected();
20697
20596
}
20698
20597
20699
20598
function markRootSuspended(root, suspendedLanes) {
20700
20599
// When suspending, we should always exclude lanes that were pinged or (more
20701
20600
// rarely, since we try to avoid it) updated during the render phase.
20601
+ // TODO: Lol maybe there's a better way to factor this besides this
20602
+ // obnoxiously named function :)
20702
20603
suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes);
20703
20604
suspendedLanes = removeLanes(
20704
20605
suspendedLanes,
20705
20606
workInProgressRootInterleavedUpdatedLanes
20706
20607
);
20707
-
20708
20608
markRootSuspended$1(root, suspendedLanes);
20709
20609
} // This is the entry point for synchronous tasks that don't go
20710
20610
// through Scheduler
@@ -20775,8 +20675,7 @@ function performSyncWorkOnRoot(root) {
20775
20675
commitRoot(
20776
20676
root,
20777
20677
workInProgressRootRecoverableErrors,
20778
- workInProgressTransitions,
20779
- workInProgressRootDidIncludeRecursiveRenderUpdate
20678
+ workInProgressTransitions
20780
20679
); // Before exiting, make sure there's a callback scheduled for the next
20781
20680
// pending level.
20782
20681
@@ -20917,7 +20816,6 @@ function prepareFreshStack(root, lanes) {
20917
20816
workInProgressRootPingedLanes = NoLanes;
20918
20817
workInProgressRootConcurrentErrors = null;
20919
20818
workInProgressRootRecoverableErrors = null;
20920
- workInProgressRootDidIncludeRecursiveRenderUpdate = false;
20921
20819
finishQueueingConcurrentUpdates();
20922
20820
20923
20821
{
@@ -21832,12 +21730,7 @@ function unwindUnitOfWork(unitOfWork) {
21832
21730
workInProgress = null;
21833
21731
}
21834
21732
21835
- function commitRoot(
21836
- root,
21837
- recoverableErrors,
21838
- transitions,
21839
- didIncludeRenderPhaseUpdate
21840
- ) {
21733
+ function commitRoot(root, recoverableErrors, transitions) {
21841
21734
// TODO: This no longer makes any sense. We already wrap the mutation and
21842
21735
// layout phases. Should be able to remove.
21843
21736
var previousUpdateLanePriority = getCurrentUpdatePriority();
@@ -21850,7 +21743,6 @@ function commitRoot(
21850
21743
root,
21851
21744
recoverableErrors,
21852
21745
transitions,
21853
- didIncludeRenderPhaseUpdate,
21854
21746
previousUpdateLanePriority
21855
21747
);
21856
21748
} finally {
@@ -21865,7 +21757,6 @@ function commitRootImpl(
21865
21757
root,
21866
21758
recoverableErrors,
21867
21759
transitions,
21868
- didIncludeRenderPhaseUpdate,
21869
21760
renderPriorityLevel
21870
21761
) {
21871
21762
do {
@@ -21921,9 +21812,7 @@ function commitRootImpl(
21921
21812
21922
21813
var concurrentlyUpdatedLanes = getConcurrentlyUpdatedLanes();
21923
21814
remainingLanes = mergeLanes(remainingLanes, concurrentlyUpdatedLanes);
21924
- markRootFinished(root, remainingLanes); // Reset this before firing side effects so we can detect recursive updates.
21925
-
21926
- didIncludeCommitPhaseUpdate = false;
21815
+ markRootFinished(root, remainingLanes);
21927
21816
21928
21817
if (root === workInProgressRoot) {
21929
21818
// We can reset these now that they are finished.
@@ -22104,18 +21993,7 @@ function commitRootImpl(
22104
21993
22105
21994
remainingLanes = root.pendingLanes;
22106
21995
22107
- if (
22108
- // Check if there was a recursive update spawned by this render, in either
22109
- // the render phase or the commit phase. We track these explicitly because
22110
- // we can't infer from the remaining lanes alone.
22111
- didIncludeCommitPhaseUpdate ||
22112
- didIncludeRenderPhaseUpdate || // As an additional precaution, we also check if there's any remaining sync
22113
- // work. Theoretically this should be unreachable but if there's a mistake
22114
- // in React it helps to be overly defensive given how hard it is to debug
22115
- // those scenarios otherwise. This won't catch recursive async updates,
22116
- // though, which is why we check the flags above first.
22117
- includesSyncLane(remainingLanes)
22118
- ) {
21996
+ if (includesSyncLane(remainingLanes)) {
22119
21997
{
22120
21998
markNestedUpdateScheduled();
22121
21999
} // Count the number of times the root synchronously re-renders without
@@ -22553,18 +22431,6 @@ function throwIfInfiniteUpdateLoopDetected() {
22553
22431
nestedPassiveUpdateCount = 0;
22554
22432
rootWithNestedUpdates = null;
22555
22433
rootWithPassiveNestedUpdates = null;
22556
-
22557
- if (executionContext & RenderContext && workInProgressRoot !== null) {
22558
- // We're in the render phase. Disable the concurrent error recovery
22559
- // mechanism to ensure that the error we're about to throw gets handled.
22560
- // We need it to trigger the nearest error boundary so that the infinite
22561
- // update loop is broken.
22562
- workInProgressRoot.errorRecoveryDisabledLanes = mergeLanes(
22563
- workInProgressRoot.errorRecoveryDisabledLanes,
22564
- workInProgressRootRenderLanes
22565
- );
22566
- }
22567
-
22568
22434
throw new Error(
22569
22435
"Maximum update depth exceeded. This can happen when a component " +
22570
22436
"repeatedly calls setState inside componentWillUpdate or " +
@@ -24037,7 +23903,7 @@ function createFiberRoot(
24037
23903
return root;
24038
23904
}
24039
23905
24040
- var ReactVersion = "18.3.0-canary-fc801116c-20230629 ";
23906
+ var ReactVersion = "18.3.0-canary-7f362de15-20230630 ";
24041
23907
24042
23908
// Might add PROFILE later.
24043
23909
0 commit comments