Skip to content

Commit 76e5823

Browse files
committed
Enable enableDeferRootSchedulingToMicrotask and enableInfiniteRenderLoopDetection for React Native (Meta) (#30090)
DiffTrain build for commit ef0f44e.
1 parent 96ce55d commit 76e5823

File tree

14 files changed

+267
-270
lines changed

14 files changed

+267
-270
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.0.0-native-fb-3154ec8a38-20240614
1+
19.0.0-native-fb-ef0f44ecff-20240626

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 58 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<0907a7cf7bb18ca353544d071f3fabbb>>
10+
* @generated SignedSource<<8e0b5ef521249935e03c766c90de416e>>
1111
*/
1212

1313
"use strict";
1414
__DEV__ &&
1515
(function () {
16-
function JSCompiler_object_inline_createNodeMock_1116() {
16+
function JSCompiler_object_inline_createNodeMock_1106() {
1717
return null;
1818
}
1919
function findHook(fiber, id) {
@@ -1015,11 +1015,6 @@ __DEV__ &&
10151015
for (var laneMap = [], i = 0; i < TotalLanes; i++) laneMap.push(initial);
10161016
return laneMap;
10171017
}
1018-
function markRootUpdated$1(root, updateLane) {
1019-
root.pendingLanes |= updateLane;
1020-
updateLane !== IdleLane &&
1021-
((root.suspendedLanes = 0), (root.pingedLanes = 0));
1022-
}
10231018
function markRootFinished(root, remainingLanes, spawnedLane) {
10241019
var noLongerPendingLanes = root.pendingLanes & ~remainingLanes;
10251020
root.pendingLanes = remainingLanes;
@@ -1803,20 +1798,7 @@ __DEV__ &&
18031798
(update.lane = lane | OffscreenLane));
18041799
}
18051800
function getRootForUpdatedFiber(sourceFiber) {
1806-
if (nestedUpdateCount > NESTED_UPDATE_LIMIT)
1807-
throw (
1808-
((nestedPassiveUpdateCount = nestedUpdateCount = 0),
1809-
(rootWithPassiveNestedUpdates = rootWithNestedUpdates = null),
1810-
Error(
1811-
"Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops."
1812-
))
1813-
);
1814-
nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT &&
1815-
((nestedPassiveUpdateCount = 0),
1816-
(rootWithPassiveNestedUpdates = null),
1817-
error$jscomp$0(
1818-
"Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render."
1819-
));
1801+
throwIfInfiniteUpdateLoopDetected();
18201802
null === sourceFiber.alternate &&
18211803
0 !== (sourceFiber.flags & 4098) &&
18221804
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
@@ -1842,7 +1824,6 @@ __DEV__ &&
18421824
: didScheduleMicrotask ||
18431825
((didScheduleMicrotask = !0),
18441826
scheduleImmediateTask(processRootScheduleInMicrotask));
1845-
scheduleTaskForRootDuringMicrotask(root, now$1());
18461827
ReactSharedInternals.isBatchingLegacy &&
18471828
0 === root.tag &&
18481829
(ReactSharedInternals.didScheduleLegacyUpdate = !0);
@@ -10618,7 +10599,7 @@ __DEV__ &&
1061810599
workInProgressRootRenderLanes,
1061910600
workInProgressDeferredLane
1062010601
);
10621-
markRootUpdated$1(root, lane);
10602+
markRootUpdated(root, lane);
1062210603
if (
1062310604
0 !== (executionContext & RenderContext) &&
1062410605
root === workInProgressRoot
@@ -10897,6 +10878,16 @@ __DEV__ &&
1089710878
}
1089810879
return !0;
1089910880
}
10881+
function markRootUpdated(root, updatedLanes) {
10882+
root.pendingLanes |= updatedLanes;
10883+
updatedLanes !== IdleLane &&
10884+
((root.suspendedLanes = 0), (root.pingedLanes = 0));
10885+
executionContext & RenderContext
10886+
? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0)
10887+
: executionContext & CommitContext &&
10888+
(didIncludeCommitPhaseUpdate = !0);
10889+
throwIfInfiniteUpdateLoopDetected();
10890+
}
1090010891
function markRootSuspended(root, suspendedLanes, spawnedLane) {
1090110892
suspendedLanes &= ~workInProgressRootPingedLanes;
1090210893
suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes;
@@ -11575,13 +11566,13 @@ __DEV__ &&
1157511566
ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
1157611567
if ((executionContext & (RenderContext | CommitContext)) !== NoContext)
1157711568
throw Error("Should not already be working.");
11578-
var finishedWork = root.finishedWork;
11579-
didIncludeRenderPhaseUpdate = root.finishedLanes;
11569+
var finishedWork = root.finishedWork,
11570+
lanes = root.finishedLanes;
1158011571
null !== injectedProfilingHooks &&
1158111572
"function" === typeof injectedProfilingHooks.markCommitStarted &&
11582-
injectedProfilingHooks.markCommitStarted(didIncludeRenderPhaseUpdate);
11573+
injectedProfilingHooks.markCommitStarted(lanes);
1158311574
if (null === finishedWork) return markCommitStopped(), null;
11584-
0 === didIncludeRenderPhaseUpdate &&
11575+
0 === lanes &&
1158511576
error$jscomp$0(
1158611577
"root.finishedLanes should not be empty during a commit. This is a bug in React."
1158711578
);
@@ -11597,6 +11588,7 @@ __DEV__ &&
1159711588
var remainingLanes = finishedWork.lanes | finishedWork.childLanes;
1159811589
remainingLanes |= concurrentlyUpdatedLanes;
1159911590
markRootFinished(root, remainingLanes, spawnedLane);
11591+
didIncludeCommitPhaseUpdate = !1;
1160011592
root === workInProgressRoot &&
1160111593
((workInProgress = workInProgressRoot = null),
1160211594
(workInProgressRootRenderLanes = 0));
@@ -11625,22 +11617,20 @@ __DEV__ &&
1162511617
commitMutationEffectsOnFiber,
1162611618
finishedWork,
1162711619
root,
11628-
didIncludeRenderPhaseUpdate
11620+
lanes
1162911621
);
1163011622
root.current = finishedWork;
1163111623
null !== injectedProfilingHooks &&
1163211624
"function" ===
1163311625
typeof injectedProfilingHooks.markLayoutEffectsStarted &&
11634-
injectedProfilingHooks.markLayoutEffectsStarted(
11635-
didIncludeRenderPhaseUpdate
11636-
);
11626+
injectedProfilingHooks.markLayoutEffectsStarted(lanes);
1163711627
runWithFiberInDEV(
1163811628
finishedWork,
1163911629
commitLayoutEffectOnFiber,
1164011630
root,
1164111631
finishedWork.alternate,
1164211632
finishedWork,
11643-
didIncludeRenderPhaseUpdate
11633+
lanes
1164411634
);
1164511635
null !== injectedProfilingHooks &&
1164611636
"function" ===
@@ -11654,7 +11644,7 @@ __DEV__ &&
1165411644
(transitions = rootDoesHavePassiveEffects)
1165511645
? ((rootDoesHavePassiveEffects = !1),
1165611646
(rootWithPendingPassiveEffects = root),
11657-
(pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate))
11647+
(pendingPassiveEffectsLanes = lanes))
1165811648
: (releaseRootPooledCache(root, remainingLanes),
1165911649
(nestedPassiveUpdateCount = 0),
1166011650
(rootWithPassiveNestedUpdates = null));
@@ -11681,8 +11671,9 @@ __DEV__ &&
1168111671
0 !== root.tag &&
1168211672
flushPassiveEffects();
1168311673
remainingLanes = root.pendingLanes;
11684-
0 !== (didIncludeRenderPhaseUpdate & UpdateLanes) &&
11685-
0 !== (remainingLanes & SyncUpdateLanes)
11674+
didIncludeRenderPhaseUpdate ||
11675+
didIncludeCommitPhaseUpdate ||
11676+
(0 !== (lanes & UpdateLanes) && 0 !== (remainingLanes & SyncUpdateLanes))
1168611677
? ((nestedUpdateScheduled = !0),
1168711678
root === rootWithNestedUpdates
1168811679
? nestedUpdateCount++
@@ -11873,7 +11864,7 @@ __DEV__ &&
1187311864
);
1187411865
rootFiber = enqueueUpdate(rootFiber, sourceFiber, SyncLane);
1187511866
null !== rootFiber &&
11876-
(markRootUpdated$1(rootFiber, SyncLane),
11867+
(markRootUpdated(rootFiber, SyncLane),
1187711868
ensureRootIsScheduled(rootFiber));
1187811869
}
1187911870
function captureCommitPhaseError(
@@ -11917,7 +11908,7 @@ __DEV__ &&
1191711908
nearestMountedAncestor,
1191811909
sourceFiber
1191911910
),
11920-
markRootUpdated$1(instance, SyncLane),
11911+
markRootUpdated(instance, SyncLane),
1192111912
ensureRootIsScheduled(instance));
1192211913
return;
1192311914
}
@@ -11950,6 +11941,11 @@ __DEV__ &&
1195011941
var pingCache = root.pingCache;
1195111942
null !== pingCache && pingCache.delete(wakeable);
1195211943
root.pingedLanes |= root.suspendedLanes & pingedLanes;
11944+
executionContext & RenderContext
11945+
? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0)
11946+
: executionContext & CommitContext &&
11947+
(didIncludeCommitPhaseUpdate = !0);
11948+
throwIfInfiniteUpdateLoopDetected();
1195311949
0 !== root.tag &&
1195411950
isConcurrentActEnvironment() &&
1195511951
null === ReactSharedInternals.actQueue &&
@@ -11974,7 +11970,7 @@ __DEV__ &&
1197411970
0 === (boundaryFiber.mode & 1) ? SyncLane : claimNextRetryLane());
1197511971
boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane);
1197611972
null !== boundaryFiber &&
11977-
(markRootUpdated$1(boundaryFiber, retryLane),
11973+
(markRootUpdated(boundaryFiber, retryLane),
1197811974
ensureRootIsScheduled(boundaryFiber));
1197911975
}
1198011976
function retryDehydratedSuspenseBoundary(boundaryFiber) {
@@ -12005,6 +12001,26 @@ __DEV__ &&
1200512001
null !== retryCache && retryCache.delete(wakeable);
1200612002
retryTimedOutBoundary(boundaryFiber, retryLane);
1200712003
}
12004+
function throwIfInfiniteUpdateLoopDetected() {
12005+
if (nestedUpdateCount > NESTED_UPDATE_LIMIT)
12006+
throw (
12007+
((nestedPassiveUpdateCount = nestedUpdateCount = 0),
12008+
(rootWithPassiveNestedUpdates = rootWithNestedUpdates = null),
12009+
executionContext & RenderContext &&
12010+
null !== workInProgressRoot &&
12011+
(workInProgressRoot.errorRecoveryDisabledLanes |=
12012+
workInProgressRootRenderLanes),
12013+
Error(
12014+
"Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops."
12015+
))
12016+
);
12017+
nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT &&
12018+
((nestedPassiveUpdateCount = 0),
12019+
(rootWithPassiveNestedUpdates = null),
12020+
error$jscomp$0(
12021+
"Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render."
12022+
));
12023+
}
1200812024
function recursivelyTraverseAndDoubleInvokeEffectsInDEV(
1200912025
root$jscomp$0,
1201012026
parentFiber,
@@ -14793,6 +14809,7 @@ __DEV__ &&
1479314809
workInProgressRootConcurrentErrors = null,
1479414810
workInProgressRootRecoverableErrors = null,
1479514811
workInProgressRootDidIncludeRecursiveRenderUpdate = !1,
14812+
didIncludeCommitPhaseUpdate = !1,
1479614813
globalMostRecentFallbackTime = 0,
1479714814
FALLBACK_THROTTLE_MS = 300,
1479814815
workInProgressRootRenderTargetTime = Infinity,
@@ -15053,20 +15070,20 @@ __DEV__ &&
1505315070
scheduleRoot: scheduleRoot,
1505415071
setRefreshHandler: setRefreshHandler,
1505515072
getCurrentFiber: getCurrentFiberForDevTools,
15056-
reconcilerVersion: "19.0.0-native-fb-3154ec8a38-20240614"
15073+
reconcilerVersion: "19.0.0-native-fb-ef0f44ecff-20240626"
1505715074
});
1505815075
})({
1505915076
findFiberByHostInstance: function () {
1506015077
throw Error("TestRenderer does not support findFiberByHostInstance()");
1506115078
},
1506215079
bundleType: 1,
15063-
version: "19.0.0-native-fb-3154ec8a38-20240614",
15080+
version: "19.0.0-native-fb-ef0f44ecff-20240626",
1506415081
rendererPackageName: "react-test-renderer"
1506515082
});
1506615083
exports._Scheduler = Scheduler;
1506715084
exports.act = act;
1506815085
exports.create = function (element, options) {
15069-
var createNodeMock = JSCompiler_object_inline_createNodeMock_1116,
15086+
var createNodeMock = JSCompiler_object_inline_createNodeMock_1106,
1507015087
isConcurrent = !1,
1507115088
isStrictMode = !1,
1507215089
concurrentUpdatesByDefault = null;

0 commit comments

Comments
 (0)