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

Function shouldYield

code/new-context-api/public/app.js:13245–13256  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13243 // When working on async work, the reconciler asks the renderer if it should
13244 // yield execution. For DOM, we implement this with requestIdleCallback.
13245 function shouldYield() {
13246 if (deadline === null) {
13247 return false;
13248 }
13249 if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) {
13250 // Disregard deadline.didTimeout. Only expired work should be flushed
13251 // during a timeout. This path is only hit for non-expired work.
13252 return false;
13253 }
13254 deadlineDidExpire = true;
13255 return true;
13256 }
13257
13258 function onUncaughtError(error) {
13259 !(nextFlushedRoot !== null) ? invariant(false, 'Should be working on a root. This error is likely caused by a bug in React. Please file an issue.') : void 0;

Callers 2

workLoopFunction · 0.70
performWorkOnRootFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected