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

Function requestWork

code/redux/public/app.js:13857–13884  ·  view source on GitHub ↗
(root, expirationTime)

Source from the content-addressed store, hash-verified

13855 // requestWork is called by the scheduler whenever a root receives an update.
13856 // It's up to the renderer to call renderRoot at some point in the future.
13857 function requestWork(root, expirationTime) {
13858 addRootToSchedule(root, expirationTime);
13859
13860 if (isRendering) {
13861 // Prevent reentrancy. Remaining work will be scheduled at the end of
13862 // the currently rendering batch.
13863 return;
13864 }
13865
13866 if (isBatchingUpdates) {
13867 // Flush work at the end of the batch.
13868 if (isUnbatchingUpdates) {
13869 // ...unless we're inside unbatchedUpdates, in which case we should
13870 // flush it now.
13871 nextFlushedRoot = root;
13872 nextFlushedExpirationTime = Sync;
13873 performWorkOnRoot(root, Sync, false);
13874 }
13875 return;
13876 }
13877
13878 // TODO: Get rid of Sync and use current time?
13879 if (expirationTime === Sync) {
13880 performSyncWork();
13881 } else {
13882 scheduleCallbackWithExpiration(expirationTime);
13883 }
13884 }
13885
13886 function addRootToSchedule(root, expirationTime) {
13887 // 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