MCPcopy Index your code
hub / github.com/microsoft/SandDance / flushSync

Function flushSync

docs/external/js/react-dom.development.js:22048–22069  ·  view source on GitHub ↗
(fn, a)

Source from the content-addressed store, hash-verified

22046 }
22047 }
22048 function flushSync(fn, a) {
22049 if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
22050 {
22051 {
22052 throw Error( "flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering." );
22053 }
22054 }
22055 }
22056
22057 var prevExecutionContext = executionContext;
22058 executionContext |= BatchedContext;
22059
22060 try {
22061 return runWithPriority$1(ImmediatePriority, fn.bind(null, a));
22062 } finally {
22063 executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch.
22064 // Note that this will happen even if batchedUpdates is higher up
22065 // the stack.
22066
22067 flushSyncCallbackQueue();
22068 }
22069 }
22070
22071 function prepareFreshStack(root, expirationTime) {
22072 root.finishedWork = null;

Callers 1

scheduleRefreshFunction · 0.85

Calls 2

runWithPriority$1Function · 0.85
flushSyncCallbackQueueFunction · 0.85

Tested by

no test coverage detected