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

Function scheduleWorkImpl

code/styling/public/app.js:13473–13520  ·  view source on GitHub ↗
(fiber, expirationTime, isErrorRecovery)

Source from the content-addressed store, hash-verified

13471 }
13472
13473 function scheduleWorkImpl(fiber, expirationTime, isErrorRecovery) {
13474 recordScheduleUpdate();
13475
13476 {
13477 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13478 var instance = fiber.stateNode;
13479 warnAboutInvalidUpdates(instance);
13480 }
13481 }
13482
13483 var node = fiber;
13484 while (node !== null) {
13485 // Walk the parent path to the root and update each node's
13486 // expiration time.
13487 if (node.expirationTime === NoWork || node.expirationTime > expirationTime) {
13488 node.expirationTime = expirationTime;
13489 }
13490 if (node.alternate !== null) {
13491 if (node.alternate.expirationTime === NoWork || node.alternate.expirationTime > expirationTime) {
13492 node.alternate.expirationTime = expirationTime;
13493 }
13494 }
13495 if (node['return'] === null) {
13496 if (node.tag === HostRoot) {
13497 var root = node.stateNode;
13498 if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
13499 // This is an interruption. (Used for performance tracking.)
13500 interruptedBy = fiber;
13501 resetStack();
13502 }
13503 if (nextRoot !== root || !isWorking) {
13504 requestWork(root, expirationTime);
13505 }
13506 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
13507 invariant(false, 'Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.');
13508 }
13509 } else {
13510 {
13511 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13512 warnAboutUpdateOnUnmounted(fiber);
13513 }
13514 }
13515 return;
13516 }
13517 }
13518 node = node['return'];
13519 }
13520 }
13521
13522 function recalculateCurrentTime() {
13523 // Subtract initial time so it fits inside 32bits

Callers 1

scheduleWorkFunction · 0.70

Calls 4

recordScheduleUpdateFunction · 0.70
resetStackFunction · 0.70
requestWorkFunction · 0.70
invariantFunction · 0.70

Tested by

no test coverage detected