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

Function scheduleWorkImpl

code/dependency-injection/public/app.js:13566–13613  ·  view source on GitHub ↗
(fiber, expirationTime, isErrorRecovery)

Source from the content-addressed store, hash-verified

13564 }
13565
13566 function scheduleWorkImpl(fiber, expirationTime, isErrorRecovery) {
13567 recordScheduleUpdate();
13568
13569 {
13570 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13571 var instance = fiber.stateNode;
13572 warnAboutInvalidUpdates(instance);
13573 }
13574 }
13575
13576 var node = fiber;
13577 while (node !== null) {
13578 // Walk the parent path to the root and update each node's
13579 // expiration time.
13580 if (node.expirationTime === NoWork || node.expirationTime > expirationTime) {
13581 node.expirationTime = expirationTime;
13582 }
13583 if (node.alternate !== null) {
13584 if (node.alternate.expirationTime === NoWork || node.alternate.expirationTime > expirationTime) {
13585 node.alternate.expirationTime = expirationTime;
13586 }
13587 }
13588 if (node['return'] === null) {
13589 if (node.tag === HostRoot) {
13590 var root = node.stateNode;
13591 if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
13592 // This is an interruption. (Used for performance tracking.)
13593 interruptedBy = fiber;
13594 resetStack();
13595 }
13596 if (nextRoot !== root || !isWorking) {
13597 requestWork(root, expirationTime);
13598 }
13599 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
13600 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.');
13601 }
13602 } else {
13603 {
13604 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13605 warnAboutUpdateOnUnmounted(fiber);
13606 }
13607 }
13608 return;
13609 }
13610 }
13611 node = node['return'];
13612 }
13613 }
13614
13615 function recalculateCurrentTime() {
13616 // 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