MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / requestWork

Function requestWork

code/higher-order-components/public/app.js:13600–13627  ·  view source on GitHub ↗
(root, expirationTime)

Source from the content-addressed store, hash-verified

13598 // requestWork is called by the scheduler whenever a root receives an update.
13599 // It's up to the renderer to call renderRoot at some point in the future.
13600 function requestWork(root, expirationTime) {
13601 addRootToSchedule(root, expirationTime);
13602
13603 if (isRendering) {
13604 // Prevent reentrancy. Remaining work will be scheduled at the end of
13605 // the currently rendering batch.
13606 return;
13607 }
13608
13609 if (isBatchingUpdates) {
13610 // Flush work at the end of the batch.
13611 if (isUnbatchingUpdates) {
13612 // ...unless we're inside unbatchedUpdates, in which case we should
13613 // flush it now.
13614 nextFlushedRoot = root;
13615 nextFlushedExpirationTime = Sync;
13616 performWorkOnRoot(root, Sync, false);
13617 }
13618 return;
13619 }
13620
13621 // TODO: Get rid of Sync and use current time?
13622 if (expirationTime === Sync) {
13623 performSyncWork();
13624 } else {
13625 scheduleCallbackWithExpiration(expirationTime);
13626 }
13627 }
13628
13629 function addRootToSchedule(root, expirationTime) {
13630 // Add the root to the schedule.

Callers 1

scheduleWorkImplFunction · 0.70

Calls 4

addRootToScheduleFunction · 0.70
performWorkOnRootFunction · 0.70
performSyncWorkFunction · 0.70

Tested by

no test coverage detected