MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / performWorkOnRoot

Function performWorkOnRoot

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

Source from the content-addressed store, hash-verified

13948 }
13949
13950 function performWorkOnRoot(root, expirationTime, isAsync) {
13951 !!isRendering ? invariant(false, 'performWorkOnRoot was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
13952
13953 isRendering = true;
13954
13955 // Check if this is async work or sync/expired work.
13956 if (!isAsync) {
13957 // Flush sync work.
13958 var finishedWork = root.finishedWork;
13959 if (finishedWork !== null) {
13960 // This root is already complete. We can commit it.
13961 completeRoot(root, finishedWork, expirationTime);
13962 } else {
13963 root.finishedWork = null;
13964 finishedWork = renderRoot(root, expirationTime, false);
13965 if (finishedWork !== null) {
13966 // We've completed the root. Commit it.
13967 completeRoot(root, finishedWork, expirationTime);
13968 }
13969 }
13970 } else {
13971 // Flush async work.
13972 var _finishedWork = root.finishedWork;
13973 if (_finishedWork !== null) {
13974 // This root is already complete. We can commit it.
13975 completeRoot(root, _finishedWork, expirationTime);
13976 } else {
13977 root.finishedWork = null;
13978 _finishedWork = renderRoot(root, expirationTime, true);
13979 if (_finishedWork !== null) {
13980 // We've completed the root. Check the deadline one more time
13981 // before committing.
13982 if (!shouldYield()) {
13983 // Still time left. Commit the root.
13984 completeRoot(root, _finishedWork, expirationTime);
13985 } else {
13986 // There's no time left. Mark this root as complete. We'll come
13987 // back and commit it later.
13988 root.finishedWork = _finishedWork;
13989 }
13990 }
13991 }
13992 }
13993
13994 isRendering = false;
13995 }
13996
13997 function completeRoot(root, finishedWork, expirationTime) {
13998 // Check if there's a batch that matches this expiration time.

Callers 3

requestWorkFunction · 0.70
performWorkFunction · 0.70
flushRootFunction · 0.70

Calls 4

invariantFunction · 0.70
completeRootFunction · 0.70
renderRootFunction · 0.70
shouldYieldFunction · 0.70

Tested by

no test coverage detected