Skip to content

Commit

Permalink
Enable enableDeferRootSchedulingToMicrotask and `enableInfiniteRend…
Browse files Browse the repository at this point in the history
…erLoopDetection` for React Native (Meta) (#30090)

DiffTrain build for commit ef0f44e.
  • Loading branch information
yungsters committed Jun 26, 2024
1 parent 96ce55d commit 76e5823
Show file tree
Hide file tree
Showing 14 changed files with 267 additions and 270 deletions.
2 changes: 1 addition & 1 deletion compiled-rn/VERSION_NATIVE_FB
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19.0.0-native-fb-3154ec8a38-20240614
19.0.0-native-fb-ef0f44ecff-20240626
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<0907a7cf7bb18ca353544d071f3fabbb>>
* @generated SignedSource<<8e0b5ef521249935e03c766c90de416e>>
*/

"use strict";
__DEV__ &&
(function () {
function JSCompiler_object_inline_createNodeMock_1116() {
function JSCompiler_object_inline_createNodeMock_1106() {
return null;
}
function findHook(fiber, id) {
Expand Down Expand Up @@ -1015,11 +1015,6 @@ __DEV__ &&
for (var laneMap = [], i = 0; i < TotalLanes; i++) laneMap.push(initial);
return laneMap;
}
function markRootUpdated$1(root, updateLane) {
root.pendingLanes |= updateLane;
updateLane !== IdleLane &&
((root.suspendedLanes = 0), (root.pingedLanes = 0));
}
function markRootFinished(root, remainingLanes, spawnedLane) {
var noLongerPendingLanes = root.pendingLanes & ~remainingLanes;
root.pendingLanes = remainingLanes;
Expand Down Expand Up @@ -1803,20 +1798,7 @@ __DEV__ &&
(update.lane = lane | OffscreenLane));
}
function getRootForUpdatedFiber(sourceFiber) {
if (nestedUpdateCount > NESTED_UPDATE_LIMIT)
throw (
((nestedPassiveUpdateCount = nestedUpdateCount = 0),
(rootWithPassiveNestedUpdates = rootWithNestedUpdates = null),
Error(
"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."
))
);
nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT &&
((nestedPassiveUpdateCount = 0),
(rootWithPassiveNestedUpdates = null),
error$jscomp$0(
"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."
));
throwIfInfiniteUpdateLoopDetected();
null === sourceFiber.alternate &&
0 !== (sourceFiber.flags & 4098) &&
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
Expand All @@ -1842,7 +1824,6 @@ __DEV__ &&
: didScheduleMicrotask ||
((didScheduleMicrotask = !0),
scheduleImmediateTask(processRootScheduleInMicrotask));
scheduleTaskForRootDuringMicrotask(root, now$1());
ReactSharedInternals.isBatchingLegacy &&
0 === root.tag &&
(ReactSharedInternals.didScheduleLegacyUpdate = !0);
Expand Down Expand Up @@ -10618,7 +10599,7 @@ __DEV__ &&
workInProgressRootRenderLanes,
workInProgressDeferredLane
);
markRootUpdated$1(root, lane);
markRootUpdated(root, lane);
if (
0 !== (executionContext & RenderContext) &&
root === workInProgressRoot
Expand Down Expand Up @@ -10897,6 +10878,16 @@ __DEV__ &&
}
return !0;
}
function markRootUpdated(root, updatedLanes) {
root.pendingLanes |= updatedLanes;
updatedLanes !== IdleLane &&
((root.suspendedLanes = 0), (root.pingedLanes = 0));
executionContext & RenderContext
? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0)
: executionContext & CommitContext &&
(didIncludeCommitPhaseUpdate = !0);
throwIfInfiniteUpdateLoopDetected();
}
function markRootSuspended(root, suspendedLanes, spawnedLane) {
suspendedLanes &= ~workInProgressRootPingedLanes;
suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes;
Expand Down Expand Up @@ -11575,13 +11566,13 @@ __DEV__ &&
ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
if ((executionContext & (RenderContext | CommitContext)) !== NoContext)
throw Error("Should not already be working.");
var finishedWork = root.finishedWork;
didIncludeRenderPhaseUpdate = root.finishedLanes;
var finishedWork = root.finishedWork,
lanes = root.finishedLanes;
null !== injectedProfilingHooks &&
"function" === typeof injectedProfilingHooks.markCommitStarted &&
injectedProfilingHooks.markCommitStarted(didIncludeRenderPhaseUpdate);
injectedProfilingHooks.markCommitStarted(lanes);
if (null === finishedWork) return markCommitStopped(), null;
0 === didIncludeRenderPhaseUpdate &&
0 === lanes &&
error$jscomp$0(
"root.finishedLanes should not be empty during a commit. This is a bug in React."
);
Expand All @@ -11597,6 +11588,7 @@ __DEV__ &&
var remainingLanes = finishedWork.lanes | finishedWork.childLanes;
remainingLanes |= concurrentlyUpdatedLanes;
markRootFinished(root, remainingLanes, spawnedLane);
didIncludeCommitPhaseUpdate = !1;
root === workInProgressRoot &&
((workInProgress = workInProgressRoot = null),
(workInProgressRootRenderLanes = 0));
Expand Down Expand Up @@ -11625,22 +11617,20 @@ __DEV__ &&
commitMutationEffectsOnFiber,
finishedWork,
root,
didIncludeRenderPhaseUpdate
lanes
);
root.current = finishedWork;
null !== injectedProfilingHooks &&
"function" ===
typeof injectedProfilingHooks.markLayoutEffectsStarted &&
injectedProfilingHooks.markLayoutEffectsStarted(
didIncludeRenderPhaseUpdate
);
injectedProfilingHooks.markLayoutEffectsStarted(lanes);
runWithFiberInDEV(
finishedWork,
commitLayoutEffectOnFiber,
root,
finishedWork.alternate,
finishedWork,
didIncludeRenderPhaseUpdate
lanes
);
null !== injectedProfilingHooks &&
"function" ===
Expand All @@ -11654,7 +11644,7 @@ __DEV__ &&
(transitions = rootDoesHavePassiveEffects)
? ((rootDoesHavePassiveEffects = !1),
(rootWithPendingPassiveEffects = root),
(pendingPassiveEffectsLanes = didIncludeRenderPhaseUpdate))
(pendingPassiveEffectsLanes = lanes))
: (releaseRootPooledCache(root, remainingLanes),
(nestedPassiveUpdateCount = 0),
(rootWithPassiveNestedUpdates = null));
Expand All @@ -11681,8 +11671,9 @@ __DEV__ &&
0 !== root.tag &&
flushPassiveEffects();
remainingLanes = root.pendingLanes;
0 !== (didIncludeRenderPhaseUpdate & UpdateLanes) &&
0 !== (remainingLanes & SyncUpdateLanes)
didIncludeRenderPhaseUpdate ||
didIncludeCommitPhaseUpdate ||
(0 !== (lanes & UpdateLanes) && 0 !== (remainingLanes & SyncUpdateLanes))
? ((nestedUpdateScheduled = !0),
root === rootWithNestedUpdates
? nestedUpdateCount++
Expand Down Expand Up @@ -11873,7 +11864,7 @@ __DEV__ &&
);
rootFiber = enqueueUpdate(rootFiber, sourceFiber, SyncLane);
null !== rootFiber &&
(markRootUpdated$1(rootFiber, SyncLane),
(markRootUpdated(rootFiber, SyncLane),
ensureRootIsScheduled(rootFiber));
}
function captureCommitPhaseError(
Expand Down Expand Up @@ -11917,7 +11908,7 @@ __DEV__ &&
nearestMountedAncestor,
sourceFiber
),
markRootUpdated$1(instance, SyncLane),
markRootUpdated(instance, SyncLane),
ensureRootIsScheduled(instance));
return;
}
Expand Down Expand Up @@ -11950,6 +11941,11 @@ __DEV__ &&
var pingCache = root.pingCache;
null !== pingCache && pingCache.delete(wakeable);
root.pingedLanes |= root.suspendedLanes & pingedLanes;
executionContext & RenderContext
? (workInProgressRootDidIncludeRecursiveRenderUpdate = !0)
: executionContext & CommitContext &&
(didIncludeCommitPhaseUpdate = !0);
throwIfInfiniteUpdateLoopDetected();
0 !== root.tag &&
isConcurrentActEnvironment() &&
null === ReactSharedInternals.actQueue &&
Expand All @@ -11974,7 +11970,7 @@ __DEV__ &&
0 === (boundaryFiber.mode & 1) ? SyncLane : claimNextRetryLane());
boundaryFiber = enqueueConcurrentRenderForLane(boundaryFiber, retryLane);
null !== boundaryFiber &&
(markRootUpdated$1(boundaryFiber, retryLane),
(markRootUpdated(boundaryFiber, retryLane),
ensureRootIsScheduled(boundaryFiber));
}
function retryDehydratedSuspenseBoundary(boundaryFiber) {
Expand Down Expand Up @@ -12005,6 +12001,26 @@ __DEV__ &&
null !== retryCache && retryCache.delete(wakeable);
retryTimedOutBoundary(boundaryFiber, retryLane);
}
function throwIfInfiniteUpdateLoopDetected() {
if (nestedUpdateCount > NESTED_UPDATE_LIMIT)
throw (
((nestedPassiveUpdateCount = nestedUpdateCount = 0),
(rootWithPassiveNestedUpdates = rootWithNestedUpdates = null),
executionContext & RenderContext &&
null !== workInProgressRoot &&
(workInProgressRoot.errorRecoveryDisabledLanes |=
workInProgressRootRenderLanes),
Error(
"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."
))
);
nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT &&
((nestedPassiveUpdateCount = 0),
(rootWithPassiveNestedUpdates = null),
error$jscomp$0(
"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."
));
}
function recursivelyTraverseAndDoubleInvokeEffectsInDEV(
root$jscomp$0,
parentFiber,
Expand Down Expand Up @@ -14793,6 +14809,7 @@ __DEV__ &&
workInProgressRootConcurrentErrors = null,
workInProgressRootRecoverableErrors = null,
workInProgressRootDidIncludeRecursiveRenderUpdate = !1,
didIncludeCommitPhaseUpdate = !1,
globalMostRecentFallbackTime = 0,
FALLBACK_THROTTLE_MS = 300,
workInProgressRootRenderTargetTime = Infinity,
Expand Down Expand Up @@ -15053,20 +15070,20 @@ __DEV__ &&
scheduleRoot: scheduleRoot,
setRefreshHandler: setRefreshHandler,
getCurrentFiber: getCurrentFiberForDevTools,
reconcilerVersion: "19.0.0-native-fb-3154ec8a38-20240614"
reconcilerVersion: "19.0.0-native-fb-ef0f44ecff-20240626"
});
})({
findFiberByHostInstance: function () {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 1,
version: "19.0.0-native-fb-3154ec8a38-20240614",
version: "19.0.0-native-fb-ef0f44ecff-20240626",
rendererPackageName: "react-test-renderer"
});
exports._Scheduler = Scheduler;
exports.act = act;
exports.create = function (element, options) {
var createNodeMock = JSCompiler_object_inline_createNodeMock_1116,
var createNodeMock = JSCompiler_object_inline_createNodeMock_1106,
isConcurrent = !1,
isStrictMode = !1,
concurrentUpdatesByDefault = null;
Expand Down
Loading

0 comments on commit 76e5823

Please sign in to comment.