MCPcopy Create free account
hub / github.com/reactjs/react-rails / performSyncWorkOnRoot

Function performSyncWorkOnRoot

lib/assets/react-source/development/react.js:25421–25497  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

25419
25420
25421 function performSyncWorkOnRoot(root) {
25422 // Check if there's expired work on this root. Otherwise, render at Sync.
25423 var lastExpiredTime = root.lastExpiredTime;
25424 var expirationTime = lastExpiredTime !== NoWork ? lastExpiredTime : Sync;
25425
25426 if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
25427 {
25428 throw Error( "Should not already be working." );
25429 }
25430 }
25431
25432 flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
25433 // and prepare a fresh one. Otherwise we'll continue where we left off.
25434
25435 if (root !== workInProgressRoot || expirationTime !== renderExpirationTime$1) {
25436 prepareFreshStack(root, expirationTime);
25437 startWorkOnPendingInteractions(root, expirationTime);
25438 } // If we have a work-in-progress fiber, it means there's still work to do
25439 // in this root.
25440
25441
25442 if (workInProgress !== null) {
25443 var prevExecutionContext = executionContext;
25444 executionContext |= RenderContext;
25445 var prevDispatcher = pushDispatcher();
25446 var prevInteractions = pushInteractions(root);
25447 startWorkLoopTimer(workInProgress);
25448
25449 do {
25450 try {
25451 workLoopSync();
25452 break;
25453 } catch (thrownValue) {
25454 handleError(root, thrownValue);
25455 }
25456 } while (true);
25457
25458 resetContextDependencies();
25459 executionContext = prevExecutionContext;
25460 popDispatcher(prevDispatcher);
25461
25462 {
25463 popInteractions(prevInteractions);
25464 }
25465
25466 if (workInProgressRootExitStatus === RootFatalErrored) {
25467 var fatalError = workInProgressRootFatalError;
25468 stopInterruptedWorkLoopTimer();
25469 prepareFreshStack(root, expirationTime);
25470 markRootSuspendedAtTime(root, expirationTime);
25471 ensureRootIsScheduled(root);
25472 throw fatalError;
25473 }
25474
25475 if (workInProgress !== null) {
25476 // This is a sync render, so we should have finished the whole tree.
25477 {
25478 {

Callers 1

scheduleUpdateOnFiberFunction · 0.85

Calls 15

flushPassiveEffectsFunction · 0.85
prepareFreshStackFunction · 0.85
pushDispatcherFunction · 0.85
pushInteractionsFunction · 0.85
startWorkLoopTimerFunction · 0.85
workLoopSyncFunction · 0.85
handleErrorFunction · 0.85
resetContextDependenciesFunction · 0.85
popDispatcherFunction · 0.85
popInteractionsFunction · 0.85

Tested by

no test coverage detected