MCPcopy Create free account
hub / github.com/microsoft/SandDance / performSyncWorkOnRoot

Function performSyncWorkOnRoot

docs/external/js/react-dom.development.js:21861–21937  ·  view source on GitHub ↗
(root)

Source from the content-addressed store, hash-verified

21859
21860
21861 function performSyncWorkOnRoot(root) {
21862 // Check if there's expired work on this root. Otherwise, render at Sync.
21863 var lastExpiredTime = root.lastExpiredTime;
21864 var expirationTime = lastExpiredTime !== NoWork ? lastExpiredTime : Sync;
21865
21866 if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) {
21867 {
21868 throw Error( "Should not already be working." );
21869 }
21870 }
21871
21872 flushPassiveEffects(); // If the root or expiration time have changed, throw out the existing stack
21873 // and prepare a fresh one. Otherwise we'll continue where we left off.
21874
21875 if (root !== workInProgressRoot || expirationTime !== renderExpirationTime$1) {
21876 prepareFreshStack(root, expirationTime);
21877 startWorkOnPendingInteractions(root, expirationTime);
21878 } // If we have a work-in-progress fiber, it means there's still work to do
21879 // in this root.
21880
21881
21882 if (workInProgress !== null) {
21883 var prevExecutionContext = executionContext;
21884 executionContext |= RenderContext;
21885 var prevDispatcher = pushDispatcher();
21886 var prevInteractions = pushInteractions(root);
21887 startWorkLoopTimer(workInProgress);
21888
21889 do {
21890 try {
21891 workLoopSync();
21892 break;
21893 } catch (thrownValue) {
21894 handleError(root, thrownValue);
21895 }
21896 } while (true);
21897
21898 resetContextDependencies();
21899 executionContext = prevExecutionContext;
21900 popDispatcher(prevDispatcher);
21901
21902 {
21903 popInteractions(prevInteractions);
21904 }
21905
21906 if (workInProgressRootExitStatus === RootFatalErrored) {
21907 var fatalError = workInProgressRootFatalError;
21908 stopInterruptedWorkLoopTimer();
21909 prepareFreshStack(root, expirationTime);
21910 markRootSuspendedAtTime(root, expirationTime);
21911 ensureRootIsScheduled(root);
21912 throw fatalError;
21913 }
21914
21915 if (workInProgress !== null) {
21916 // This is a sync render, so we should have finished the whole tree.
21917 {
21918 {

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