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

Function renderRoot

code/one-direction-data-flow/public/app.js:13138–13215  ·  view source on GitHub ↗
(root, expirationTime, isAsync)

Source from the content-addressed store, hash-verified

13136 }
13137
13138 function renderRoot(root, expirationTime, isAsync) {
13139 !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13140 isWorking = true;
13141
13142 // Check if we're starting from a fresh stack, or if we're resuming from
13143 // previously yielded work.
13144 if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) {
13145 // Reset the stack and start working from the root.
13146 resetStack();
13147 nextRoot = root;
13148 nextRenderExpirationTime = expirationTime;
13149 nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime);
13150 root.pendingCommitExpirationTime = NoWork;
13151 }
13152
13153 var didFatal = false;
13154
13155 startWorkLoopTimer(nextUnitOfWork);
13156
13157 do {
13158 try {
13159 workLoop(isAsync);
13160 } catch (thrownValue) {
13161 if (nextUnitOfWork === null) {
13162 // This is a fatal error.
13163 didFatal = true;
13164 onUncaughtError(thrownValue);
13165 break;
13166 }
13167
13168 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
13169 var failedUnitOfWork = nextUnitOfWork;
13170 replayUnitOfWork(failedUnitOfWork, isAsync);
13171 }
13172
13173 var sourceFiber = nextUnitOfWork;
13174 var returnFiber = sourceFiber['return'];
13175 if (returnFiber === null) {
13176 // This is a fatal error.
13177 didFatal = true;
13178 onUncaughtError(thrownValue);
13179 break;
13180 }
13181 throwException(returnFiber, sourceFiber, thrownValue);
13182 nextUnitOfWork = completeUnitOfWork(sourceFiber);
13183 }
13184 break;
13185 } while (true);
13186
13187 // We're done performing work. Time to clean up.
13188 stopWorkLoopTimer(interruptedBy);
13189 interruptedBy = null;
13190 isWorking = false;
13191
13192 // Yield back to main thread.
13193 if (didFatal) {
13194 // There was a fatal error.
13195 {

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