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

Function requestWork

code/composition/public/app.js:13744–13771  ·  view source on GitHub ↗
(root, expirationTime)

Source from the content-addressed store, hash-verified

13742 // requestWork is called by the scheduler whenever a root receives an update.
13743 // It's up to the renderer to call renderRoot at some point in the future.
13744 function requestWork(root, expirationTime) {
13745 addRootToSchedule(root, expirationTime);
13746
13747 if (isRendering) {
13748 // Prevent reentrancy. Remaining work will be scheduled at the end of
13749 // the currently rendering batch.
13750 return;
13751 }
13752
13753 if (isBatchingUpdates) {
13754 // Flush work at the end of the batch.
13755 if (isUnbatchingUpdates) {
13756 // ...unless we're inside unbatchedUpdates, in which case we should
13757 // flush it now.
13758 nextFlushedRoot = root;
13759 nextFlushedExpirationTime = Sync;
13760 performWorkOnRoot(root, Sync, false);
13761 }
13762 return;
13763 }
13764
13765 // TODO: Get rid of Sync and use current time?
13766 if (expirationTime === Sync) {
13767 performSyncWork();
13768 } else {
13769 scheduleCallbackWithExpiration(expirationTime);
13770 }
13771 }
13772
13773 function addRootToSchedule(root, expirationTime) {
13774 // 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