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

Function flushDiscreteUpdates

lib/assets/react-source/development/react.js:25504–25526  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25502 commitRoot(root);
25503 }
25504 function flushDiscreteUpdates() {
25505 // TODO: Should be able to flush inside batchedUpdates, but not inside `act`.
25506 // However, `act` uses `batchedUpdates`, so there's no way to distinguish
25507 // those two cases. Need to fix this before exposing flushDiscreteUpdates
25508 // as a public API.
25509 if ((executionContext & (BatchedContext | RenderContext | CommitContext)) !== NoContext) {
25510 {
25511 if ((executionContext & RenderContext) !== NoContext) {
25512 error('unstable_flushDiscreteUpdates: Cannot flush updates when React is ' + 'already rendering.');
25513 }
25514 } // We're already rendering, so we can't synchronously flush pending work.
25515 // This is probably a nested event dispatch triggered by a lifecycle/effect,
25516 // like `el.focus()`. Exit.
25517
25518
25519 return;
25520 }
25521
25522 flushPendingDiscreteUpdates(); // If the discrete updates scheduled passive effects, flush them now so that
25523 // they fire before the next serial event.
25524
25525 flushPassiveEffects();
25526 }
25527 function syncUpdates(fn, a, b, c) {
25528 return runWithPriority$1(ImmediatePriority, fn.bind(null, a, b, c));
25529 }

Callers

nothing calls this directly

Calls 3

flushPassiveEffectsFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected