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

Function scheduleWorkImpl

code/communication/public/app.js:13508–13555  ·  view source on GitHub ↗
(fiber, expirationTime, isErrorRecovery)

Source from the content-addressed store, hash-verified

13506 }
13507
13508 function scheduleWorkImpl(fiber, expirationTime, isErrorRecovery) {
13509 recordScheduleUpdate();
13510
13511 {
13512 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13513 var instance = fiber.stateNode;
13514 warnAboutInvalidUpdates(instance);
13515 }
13516 }
13517
13518 var node = fiber;
13519 while (node !== null) {
13520 // Walk the parent path to the root and update each node's
13521 // expiration time.
13522 if (node.expirationTime === NoWork || node.expirationTime > expirationTime) {
13523 node.expirationTime = expirationTime;
13524 }
13525 if (node.alternate !== null) {
13526 if (node.alternate.expirationTime === NoWork || node.alternate.expirationTime > expirationTime) {
13527 node.alternate.expirationTime = expirationTime;
13528 }
13529 }
13530 if (node['return'] === null) {
13531 if (node.tag === HostRoot) {
13532 var root = node.stateNode;
13533 if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
13534 // This is an interruption. (Used for performance tracking.)
13535 interruptedBy = fiber;
13536 resetStack();
13537 }
13538 if (nextRoot !== root || !isWorking) {
13539 requestWork(root, expirationTime);
13540 }
13541 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
13542 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.');
13543 }
13544 } else {
13545 {
13546 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13547 warnAboutUpdateOnUnmounted(fiber);
13548 }
13549 }
13550 return;
13551 }
13552 }
13553 node = node['return'];
13554 }
13555 }
13556
13557 function recalculateCurrentTime() {
13558 // 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