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

Function scheduleWorkImpl

code/third-party/public/app.js:12706–12753  ·  view source on GitHub ↗
(fiber, expirationTime, isErrorRecovery)

Source from the content-addressed store, hash-verified

12704 }
12705
12706 function scheduleWorkImpl(fiber, expirationTime, isErrorRecovery) {
12707 recordScheduleUpdate();
12708
12709 {
12710 if (!isErrorRecovery && fiber.tag === ClassComponent) {
12711 var instance = fiber.stateNode;
12712 warnAboutInvalidUpdates(instance);
12713 }
12714 }
12715
12716 var node = fiber;
12717 while (node !== null) {
12718 // Walk the parent path to the root and update each node's
12719 // expiration time.
12720 if (node.expirationTime === NoWork || node.expirationTime > expirationTime) {
12721 node.expirationTime = expirationTime;
12722 }
12723 if (node.alternate !== null) {
12724 if (node.alternate.expirationTime === NoWork || node.alternate.expirationTime > expirationTime) {
12725 node.alternate.expirationTime = expirationTime;
12726 }
12727 }
12728 if (node['return'] === null) {
12729 if (node.tag === HostRoot) {
12730 var root = node.stateNode;
12731 if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
12732 // This is an interruption. (Used for performance tracking.)
12733 interruptedBy = fiber;
12734 resetStack();
12735 }
12736 if (nextRoot !== root || !isWorking) {
12737 requestWork(root, expirationTime);
12738 }
12739 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
12740 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.');
12741 }
12742 } else {
12743 {
12744 if (!isErrorRecovery && fiber.tag === ClassComponent) {
12745 warnAboutUpdateOnUnmounted(fiber);
12746 }
12747 }
12748 return;
12749 }
12750 }
12751 node = node['return'];
12752 }
12753 }
12754
12755 function recalculateCurrentTime() {
12756 // 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