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

Function requestWork

code/styling/public/app.js:13606–13633  ·  view source on GitHub ↗
(root, expirationTime)

Source from the content-addressed store, hash-verified

13604 // requestWork is called by the scheduler whenever a root receives an update.
13605 // It's up to the renderer to call renderRoot at some point in the future.
13606 function requestWork(root, expirationTime) {
13607 addRootToSchedule(root, expirationTime);
13608
13609 if (isRendering) {
13610 // Prevent reentrancy. Remaining work will be scheduled at the end of
13611 // the currently rendering batch.
13612 return;
13613 }
13614
13615 if (isBatchingUpdates) {
13616 // Flush work at the end of the batch.
13617 if (isUnbatchingUpdates) {
13618 // ...unless we're inside unbatchedUpdates, in which case we should
13619 // flush it now.
13620 nextFlushedRoot = root;
13621 nextFlushedExpirationTime = Sync;
13622 performWorkOnRoot(root, Sync, false);
13623 }
13624 return;
13625 }
13626
13627 // TODO: Get rid of Sync and use current time?
13628 if (expirationTime === Sync) {
13629 performSyncWork();
13630 } else {
13631 scheduleCallbackWithExpiration(expirationTime);
13632 }
13633 }
13634
13635 function addRootToSchedule(root, expirationTime) {
13636 // 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