in Libraries/Renderer/implementations/ReactFabric-prod.js [6104:6240]
function performConcurrentWorkOnRoot(root, didTimeout) {
currentEventTime = -1;
currentEventTransitionLane = 0;
if (0 !== (executionContext & 24))
throw Error("Should not already be working.");
var originalCallbackNode = root.callbackNode;
if (flushPassiveEffects() && root.callbackNode !== originalCallbackNode)
return null;
var lanes = getNextLanes(
root,
root === workInProgressRoot ? workInProgressRootRenderLanes : 0
);
if (0 === lanes) return null;
var JSCompiler_inline_result =
0 !== (lanes & root.expiredLanes) ? !1 : 0 === (lanes & 30);
if (JSCompiler_inline_result && !didTimeout) {
didTimeout = lanes;
JSCompiler_inline_result = executionContext;
executionContext |= 8;
var prevDispatcher = pushDispatcher();
if (
workInProgressRoot !== root ||
workInProgressRootRenderLanes !== didTimeout
)
(workInProgressRootRenderTargetTime = now() + 500),
prepareFreshStack(root, didTimeout);
do
try {
workLoopConcurrent();
break;
} catch (thrownValue) {
handleError(root, thrownValue);
}
while (1);
resetContextDependencies();
ReactCurrentDispatcher$2.current = prevDispatcher;
executionContext = JSCompiler_inline_result;
null !== workInProgress
? (didTimeout = 0)
: ((workInProgressRoot = null),
(workInProgressRootRenderLanes = 0),
(didTimeout = workInProgressRootExitStatus));
} else didTimeout = renderRootSync(root, lanes);
if (0 !== didTimeout) {
2 === didTimeout &&
((executionContext |= 32),
root.hydrate && ((root.hydrate = !1), shim(root.containerInfo)),
(JSCompiler_inline_result = getLanesToRetrySynchronouslyOnError(root)),
0 !== JSCompiler_inline_result &&
((lanes = JSCompiler_inline_result),
(didTimeout = renderRootSync(root, JSCompiler_inline_result))));
if (1 === didTimeout)
throw ((originalCallbackNode = workInProgressRootFatalError),
prepareFreshStack(root, 0),
markRootSuspended$1(root, lanes),
ensureRootIsScheduled(root, now()),
originalCallbackNode);
root.finishedWork = root.current.alternate;
root.finishedLanes = lanes;
switch (didTimeout) {
case 0:
case 1:
throw Error("Root did not complete. This is a bug in React.");
case 2:
commitRoot(root);
break;
case 3:
markRootSuspended$1(root, lanes);
if (
(lanes & 130023424) === lanes &&
((didTimeout = globalMostRecentFallbackTime + 500 - now()),
10 < didTimeout)
) {
if (0 !== getNextLanes(root, 0)) break;
JSCompiler_inline_result = root.suspendedLanes;
if ((JSCompiler_inline_result & lanes) !== lanes) {
requestEventTime();
root.pingedLanes |= root.suspendedLanes & JSCompiler_inline_result;
break;
}
root.timeoutHandle = scheduleTimeout(
commitRoot.bind(null, root),
didTimeout
);
break;
}
commitRoot(root);
break;
case 4:
markRootSuspended$1(root, lanes);
if ((lanes & 4194240) === lanes) break;
didTimeout = root.eventTimes;
for (JSCompiler_inline_result = -1; 0 < lanes; ) {
var index$4 = 31 - clz32(lanes);
prevDispatcher = 1 << index$4;
index$4 = didTimeout[index$4];
index$4 > JSCompiler_inline_result &&
(JSCompiler_inline_result = index$4);
lanes &= ~prevDispatcher;
}
lanes = JSCompiler_inline_result;
lanes = now() - lanes;
lanes =
(120 > lanes
? 120
: 480 > lanes
? 480
: 1080 > lanes
? 1080
: 1920 > lanes
? 1920
: 3e3 > lanes
? 3e3
: 4320 > lanes
? 4320
: 1960 * ceil(lanes / 1960)) - lanes;
if (10 < lanes) {
root.timeoutHandle = scheduleTimeout(
commitRoot.bind(null, root),
lanes
);
break;
}
commitRoot(root);
break;
case 5:
commitRoot(root);
break;
default:
throw Error("Unknown root exit status.");
}
}
ensureRootIsScheduled(root, now());
return root.callbackNode === originalCallbackNode
? performConcurrentWorkOnRoot.bind(null, root)
: null;
}