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

Function requestWork

code/one-direction-data-flow/public/app.js:13479–13506  ·  view source on GitHub ↗
(root, expirationTime)

Source from the content-addressed store, hash-verified

13477 // requestWork is called by the scheduler whenever a root receives an update.
13478 // It's up to the renderer to call renderRoot at some point in the future.
13479 function requestWork(root, expirationTime) {
13480 addRootToSchedule(root, expirationTime);
13481
13482 if (isRendering) {
13483 // Prevent reentrancy. Remaining work will be scheduled at the end of
13484 // the currently rendering batch.
13485 return;
13486 }
13487
13488 if (isBatchingUpdates) {
13489 // Flush work at the end of the batch.
13490 if (isUnbatchingUpdates) {
13491 // ...unless we're inside unbatchedUpdates, in which case we should
13492 // flush it now.
13493 nextFlushedRoot = root;
13494 nextFlushedExpirationTime = Sync;
13495 performWorkOnRoot(root, Sync, false);
13496 }
13497 return;
13498 }
13499
13500 // TODO: Get rid of Sync and use current time?
13501 if (expirationTime === Sync) {
13502 performSyncWork();
13503 } else {
13504 scheduleCallbackWithExpiration(expirationTime);
13505 }
13506 }
13507
13508 function addRootToSchedule(root, expirationTime) {
13509 // 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