MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / scheduleWorkImpl

Function scheduleWorkImpl

code/composition/public/app.js:13611–13658  ·  view source on GitHub ↗
(fiber, expirationTime, isErrorRecovery)

Source from the content-addressed store, hash-verified

13609 }
13610
13611 function scheduleWorkImpl(fiber, expirationTime, isErrorRecovery) {
13612 recordScheduleUpdate();
13613
13614 {
13615 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13616 var instance = fiber.stateNode;
13617 warnAboutInvalidUpdates(instance);
13618 }
13619 }
13620
13621 var node = fiber;
13622 while (node !== null) {
13623 // Walk the parent path to the root and update each node's
13624 // expiration time.
13625 if (node.expirationTime === NoWork || node.expirationTime > expirationTime) {
13626 node.expirationTime = expirationTime;
13627 }
13628 if (node.alternate !== null) {
13629 if (node.alternate.expirationTime === NoWork || node.alternate.expirationTime > expirationTime) {
13630 node.alternate.expirationTime = expirationTime;
13631 }
13632 }
13633 if (node['return'] === null) {
13634 if (node.tag === HostRoot) {
13635 var root = node.stateNode;
13636 if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
13637 // This is an interruption. (Used for performance tracking.)
13638 interruptedBy = fiber;
13639 resetStack();
13640 }
13641 if (nextRoot !== root || !isWorking) {
13642 requestWork(root, expirationTime);
13643 }
13644 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
13645 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.');
13646 }
13647 } else {
13648 {
13649 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13650 warnAboutUpdateOnUnmounted(fiber);
13651 }
13652 }
13653 return;
13654 }
13655 }
13656 node = node['return'];
13657 }
13658 }
13659
13660 function recalculateCurrentTime() {
13661 // 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