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

Function requestWork

code/dependency-injection/public/app.js:13699–13726  ·  view source on GitHub ↗
(root, expirationTime)

Source from the content-addressed store, hash-verified

13697 // requestWork is called by the scheduler whenever a root receives an update.
13698 // It's up to the renderer to call renderRoot at some point in the future.
13699 function requestWork(root, expirationTime) {
13700 addRootToSchedule(root, expirationTime);
13701
13702 if (isRendering) {
13703 // Prevent reentrancy. Remaining work will be scheduled at the end of
13704 // the currently rendering batch.
13705 return;
13706 }
13707
13708 if (isBatchingUpdates) {
13709 // Flush work at the end of the batch.
13710 if (isUnbatchingUpdates) {
13711 // ...unless we're inside unbatchedUpdates, in which case we should
13712 // flush it now.
13713 nextFlushedRoot = root;
13714 nextFlushedExpirationTime = Sync;
13715 performWorkOnRoot(root, Sync, false);
13716 }
13717 return;
13718 }
13719
13720 // TODO: Get rid of Sync and use current time?
13721 if (expirationTime === Sync) {
13722 performSyncWork();
13723 } else {
13724 scheduleCallbackWithExpiration(expirationTime);
13725 }
13726 }
13727
13728 function addRootToSchedule(root, expirationTime) {
13729 // 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