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

Function scheduleWorkImpl

code/higher-order-components/public/app.js:13467–13514  ·  view source on GitHub ↗
(fiber, expirationTime, isErrorRecovery)

Source from the content-addressed store, hash-verified

13465 }
13466
13467 function scheduleWorkImpl(fiber, expirationTime, isErrorRecovery) {
13468 recordScheduleUpdate();
13469
13470 {
13471 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13472 var instance = fiber.stateNode;
13473 warnAboutInvalidUpdates(instance);
13474 }
13475 }
13476
13477 var node = fiber;
13478 while (node !== null) {
13479 // Walk the parent path to the root and update each node's
13480 // expiration time.
13481 if (node.expirationTime === NoWork || node.expirationTime > expirationTime) {
13482 node.expirationTime = expirationTime;
13483 }
13484 if (node.alternate !== null) {
13485 if (node.alternate.expirationTime === NoWork || node.alternate.expirationTime > expirationTime) {
13486 node.alternate.expirationTime = expirationTime;
13487 }
13488 }
13489 if (node['return'] === null) {
13490 if (node.tag === HostRoot) {
13491 var root = node.stateNode;
13492 if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
13493 // This is an interruption. (Used for performance tracking.)
13494 interruptedBy = fiber;
13495 resetStack();
13496 }
13497 if (nextRoot !== root || !isWorking) {
13498 requestWork(root, expirationTime);
13499 }
13500 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
13501 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.');
13502 }
13503 } else {
13504 {
13505 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13506 warnAboutUpdateOnUnmounted(fiber);
13507 }
13508 }
13509 return;
13510 }
13511 }
13512 node = node['return'];
13513 }
13514 }
13515
13516 function recalculateCurrentTime() {
13517 // 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