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

Function scheduleWorkImpl

code/controlled-uncontrolled/public/app.js:12797–12844  ·  view source on GitHub ↗
(fiber, expirationTime, isErrorRecovery)

Source from the content-addressed store, hash-verified

12795 }
12796
12797 function scheduleWorkImpl(fiber, expirationTime, isErrorRecovery) {
12798 recordScheduleUpdate();
12799
12800 {
12801 if (!isErrorRecovery && fiber.tag === ClassComponent) {
12802 var instance = fiber.stateNode;
12803 warnAboutInvalidUpdates(instance);
12804 }
12805 }
12806
12807 var node = fiber;
12808 while (node !== null) {
12809 // Walk the parent path to the root and update each node's
12810 // expiration time.
12811 if (node.expirationTime === NoWork || node.expirationTime > expirationTime) {
12812 node.expirationTime = expirationTime;
12813 }
12814 if (node.alternate !== null) {
12815 if (node.alternate.expirationTime === NoWork || node.alternate.expirationTime > expirationTime) {
12816 node.alternate.expirationTime = expirationTime;
12817 }
12818 }
12819 if (node['return'] === null) {
12820 if (node.tag === HostRoot) {
12821 var root = node.stateNode;
12822 if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
12823 // This is an interruption. (Used for performance tracking.)
12824 interruptedBy = fiber;
12825 resetStack();
12826 }
12827 if (nextRoot !== root || !isWorking) {
12828 requestWork(root, expirationTime);
12829 }
12830 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
12831 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.');
12832 }
12833 } else {
12834 {
12835 if (!isErrorRecovery && fiber.tag === ClassComponent) {
12836 warnAboutUpdateOnUnmounted(fiber);
12837 }
12838 }
12839 return;
12840 }
12841 }
12842 node = node['return'];
12843 }
12844 }
12845
12846 function recalculateCurrentTime() {
12847 // 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