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

Function scheduleWorkImpl

code/redux/public/app.js:13724–13771  ·  view source on GitHub ↗
(fiber, expirationTime, isErrorRecovery)

Source from the content-addressed store, hash-verified

13722 }
13723
13724 function scheduleWorkImpl(fiber, expirationTime, isErrorRecovery) {
13725 recordScheduleUpdate();
13726
13727 {
13728 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13729 var instance = fiber.stateNode;
13730 warnAboutInvalidUpdates(instance);
13731 }
13732 }
13733
13734 var node = fiber;
13735 while (node !== null) {
13736 // Walk the parent path to the root and update each node's
13737 // expiration time.
13738 if (node.expirationTime === NoWork || node.expirationTime > expirationTime) {
13739 node.expirationTime = expirationTime;
13740 }
13741 if (node.alternate !== null) {
13742 if (node.alternate.expirationTime === NoWork || node.alternate.expirationTime > expirationTime) {
13743 node.alternate.expirationTime = expirationTime;
13744 }
13745 }
13746 if (node['return'] === null) {
13747 if (node.tag === HostRoot) {
13748 var root = node.stateNode;
13749 if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
13750 // This is an interruption. (Used for performance tracking.)
13751 interruptedBy = fiber;
13752 resetStack();
13753 }
13754 if (nextRoot !== root || !isWorking) {
13755 requestWork(root, expirationTime);
13756 }
13757 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
13758 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.');
13759 }
13760 } else {
13761 {
13762 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13763 warnAboutUpdateOnUnmounted(fiber);
13764 }
13765 }
13766 return;
13767 }
13768 }
13769 node = node['return'];
13770 }
13771 }
13772
13773 function recalculateCurrentTime() {
13774 // 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