MCPcopy Create free account
hub / github.com/react/react / scheduleCallback

Function scheduleCallback

packages/react-reconciler/src/ReactFiberRootScheduler.js:626–639  ·  view source on GitHub ↗
(
  priorityLevel: PriorityLevel,
  callback: RenderTaskFn,
)

Source from the content-addressed store, hash-verified

624const fakeActCallbackNode = {};
625
626function scheduleCallback(
627 priorityLevel: PriorityLevel,
628 callback: RenderTaskFn,
629) {
630 if (__DEV__ && ReactSharedInternals.actQueue !== null) {
631 // Special case: We're inside an `act` scope (a testing utility).
632 // Instead of scheduling work in the host environment, add it to a
633 // fake internal queue that's managed by the `act` implementation.
634 ReactSharedInternals.actQueue.push(callback);
635 return fakeActCallbackNode;
636 } else {
637 return Scheduler_scheduleCallback(priorityLevel, callback);
638 }
639}
640
641function cancelCallback(callbackNode: mixed) {
642 if (__DEV__ && callbackNode === fakeActCallbackNode) {

Callers 4

commitRootFunction · 0.90
flushSpawnedWorkFunction · 0.90
flushPassiveEffectsImplFunction · 0.90

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected