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

Function renderRoot

code/styling/public/app.js:13265–13342  ·  view source on GitHub ↗
(root, expirationTime, isAsync)

Source from the content-addressed store, hash-verified

13263 }
13264
13265 function renderRoot(root, expirationTime, isAsync) {
13266 !!isWorking ? invariant(false, 'renderRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13267 isWorking = true;
13268
13269 // Check if we're starting from a fresh stack, or if we're resuming from
13270 // previously yielded work.
13271 if (expirationTime !== nextRenderExpirationTime || root !== nextRoot || nextUnitOfWork === null) {
13272 // Reset the stack and start working from the root.
13273 resetStack();
13274 nextRoot = root;
13275 nextRenderExpirationTime = expirationTime;
13276 nextUnitOfWork = createWorkInProgress(nextRoot.current, null, nextRenderExpirationTime);
13277 root.pendingCommitExpirationTime = NoWork;
13278 }
13279
13280 var didFatal = false;
13281
13282 startWorkLoopTimer(nextUnitOfWork);
13283
13284 do {
13285 try {
13286 workLoop(isAsync);
13287 } catch (thrownValue) {
13288 if (nextUnitOfWork === null) {
13289 // This is a fatal error.
13290 didFatal = true;
13291 onUncaughtError(thrownValue);
13292 break;
13293 }
13294
13295 if (true && replayFailedUnitOfWorkWithInvokeGuardedCallback) {
13296 var failedUnitOfWork = nextUnitOfWork;
13297 replayUnitOfWork(failedUnitOfWork, isAsync);
13298 }
13299
13300 var sourceFiber = nextUnitOfWork;
13301 var returnFiber = sourceFiber['return'];
13302 if (returnFiber === null) {
13303 // This is a fatal error.
13304 didFatal = true;
13305 onUncaughtError(thrownValue);
13306 break;
13307 }
13308 throwException(returnFiber, sourceFiber, thrownValue);
13309 nextUnitOfWork = completeUnitOfWork(sourceFiber);
13310 }
13311 break;
13312 } while (true);
13313
13314 // We're done performing work. Time to clean up.
13315 stopWorkLoopTimer(interruptedBy);
13316 interruptedBy = null;
13317 isWorking = false;
13318
13319 // Yield back to main thread.
13320 if (didFatal) {
13321 // There was a fatal error.
13322 {

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