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

Function flushSync

lib/assets/react-source/development/react.js:25608–25629  ·  view source on GitHub ↗
(fn, a)

Source from the content-addressed store, hash-verified

25606 }
25607 }
25608 function flushSync(fn, a) {
25609 if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
25610 {
25611 {
25612 throw Error( "flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering." );
25613 }
25614 }
25615 }
25616
25617 var prevExecutionContext = executionContext;
25618 executionContext |= BatchedContext;
25619
25620 try {
25621 return runWithPriority$1(ImmediatePriority, fn.bind(null, a));
25622 } finally {
25623 executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch.
25624 // Note that this will happen even if batchedUpdates is higher up
25625 // the stack.
25626
25627 flushSyncCallbackQueue();
25628 }
25629 }
25630
25631 function prepareFreshStack(root, expirationTime) {
25632 root.finishedWork = null;

Callers 1

scheduleRefreshFunction · 0.85

Calls 2

runWithPriority$1Function · 0.85
flushSyncCallbackQueueFunction · 0.85

Tested by

no test coverage detected