MCPcopy
hub / github.com/facebook/react / scheduleCallback

Function scheduleCallback

packages/react-reconciler/src/ReactFiberWorkLoop.js:5238–5253  ·  view source on GitHub ↗
(priorityLevel: any, callback)

Source from the content-addressed store, hash-verified

5236const fakeActCallbackNode = {};
5237// $FlowFixMe[missing-local-annot]
5238function scheduleCallback(priorityLevel: any, callback) {
5239 if (__DEV__) {
5240 // If we're currently inside an `act` scope, bypass Scheduler and push to
5241 // the `act` queue instead.
5242 const actQueue = ReactSharedInternals.actQueue;
5243 if (actQueue !== null) {
5244 actQueue.push(callback);
5245 return fakeActCallbackNode;
5246 } else {
5247 return Scheduler_scheduleCallback(priorityLevel, callback);
5248 }
5249 } else {
5250 // In production, always call Scheduler. This function will be stripped out.
5251 return Scheduler_scheduleCallback(priorityLevel, callback);
5252 }
5253}
5254
5255function shouldForceFlushFallbacksInDEV() {
5256 // Never force flush in production. This function should get stripped out.

Calls 1

pushMethod · 0.65

Tested by 1

workFunction · 0.40