MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / renderRoot

Function renderRoot

code/controlled-uncontrolled/public/app.js:12589–12666  ·  view source on GitHub ↗
(root, expirationTime, isAsync)

Source from the content-addressed store, hash-verified

12587 }
12588
12589 function renderRoot(root, expirationTime, isAsync) {
12590 !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
12591 isWorking = true;
12592
12593 // Check if we're starting from a fresh stack, or if we're resuming from
12594 // previously yielded work.
12595 if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) {
12596 // Reset the stack and start working from the root.
12597 resetStack();
12598 nextRoot = root;
12599 nextRenderExpirationTime = expirationTime;
12600 nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime);
12601 root.pendingCommitExpirationTime = NoWork;
12602 }
12603
12604 var didFatal = false;
12605
12606 startWorkLoopTimer(nextUnitOfWork);
12607
12608 do {
12609 try {
12610 workLoop(isAsync);
12611 } catch (thrownValue) {
12612 if (nextUnitOfWork === null) {
12613 // This is a fatal error.
12614 didFatal = true;
12615 onUncaughtError(thrownValue);
12616 break;
12617 }
12618
12619 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
12620 var failedUnitOfWork = nextUnitOfWork;
12621 replayUnitOfWork(failedUnitOfWork, isAsync);
12622 }
12623
12624 var sourceFiber = nextUnitOfWork;
12625 var returnFiber = sourceFiber['return'];
12626 if (returnFiber === null) {
12627 // This is a fatal error.
12628 didFatal = true;
12629 onUncaughtError(thrownValue);
12630 break;
12631 }
12632 throwException(returnFiber, sourceFiber, thrownValue);
12633 nextUnitOfWork = completeUnitOfWork(sourceFiber);
12634 }
12635 break;
12636 } while (true);
12637
12638 // We're done performing work. Time to clean up.
12639 stopWorkLoopTimer(interruptedBy);
12640 interruptedBy = null;
12641 isWorking = false;
12642
12643 // Yield back to main thread.
12644 if (didFatal) {
12645 // There was a fatal error.
12646 {

Callers 1

performWorkOnRootFunction · 0.70

Calls 9

invariantFunction · 0.70
resetStackFunction · 0.70
createWorkInProgressFunction · 0.70
startWorkLoopTimerFunction · 0.70
workLoopFunction · 0.70
onUncaughtErrorFunction · 0.70
throwExceptionFunction · 0.70
completeUnitOfWorkFunction · 0.70
stopWorkLoopTimerFunction · 0.70

Tested by

no test coverage detected