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

Function requestWork

code/communication/public/app.js:13641–13668  ·  view source on GitHub ↗
(root, expirationTime)

Source from the content-addressed store, hash-verified

13639 // requestWork is called by the scheduler whenever a root receives an update.
13640 // It's up to the renderer to call renderRoot at some point in the future.
13641 function requestWork(root, expirationTime) {
13642 addRootToSchedule(root, expirationTime);
13643
13644 if (isRendering) {
13645 // Prevent reentrancy. Remaining work will be scheduled at the end of
13646 // the currently rendering batch.
13647 return;
13648 }
13649
13650 if (isBatchingUpdates) {
13651 // Flush work at the end of the batch.
13652 if (isUnbatchingUpdates) {
13653 // ...unless we're inside unbatchedUpdates, in which case we should
13654 // flush it now.
13655 nextFlushedRoot = root;
13656 nextFlushedExpirationTime = Sync;
13657 performWorkOnRoot(root, Sync, false);
13658 }
13659 return;
13660 }
13661
13662 // TODO: Get rid of Sync and use current time?
13663 if (expirationTime === Sync) {
13664 performSyncWork();
13665 } else {
13666 scheduleCallbackWithExpiration(expirationTime);
13667 }
13668 }
13669
13670 function addRootToSchedule(root, expirationTime) {
13671 // 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