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

Function shouldYield

code/controlled-uncontrolled/public/app.js:13208–13219  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13206 // When working on async work, the reconciler asks the renderer if it should
13207 // yield execution. For DOM, we implement this with requestIdleCallback.
13208 function shouldYield() {
13209 if (deadline === null) {
13210 return false;
13211 }
13212 if (deadline.timeRemaining() > timeHeuristicForUnitOfWork) {
13213 // Disregard deadline.didTimeout. Only expired work should be flushed
13214 // during a timeout. This path is only hit for non-expired work.
13215 return false;
13216 }
13217 deadlineDidExpire = true;
13218 return true;
13219 }
13220
13221 function onUncaughtError(error) {
13222 !(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