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

Function scheduleWorkImpl

code/one-direction-data-flow/public/app.js:13346–13393  ·  view source on GitHub ↗
(fiber, expirationTime, isErrorRecovery)

Source from the content-addressed store, hash-verified

13344 }
13345
13346 function scheduleWorkImpl(fiber, expirationTime, isErrorRecovery) {
13347 recordScheduleUpdate();
13348
13349 {
13350 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13351 var instance = fiber.stateNode;
13352 warnAboutInvalidUpdates(instance);
13353 }
13354 }
13355
13356 var node = fiber;
13357 while (node !== null) {
13358 // Walk the parent path to the root and update each node's
13359 // expiration time.
13360 if (node.expirationTime === NoWork || node.expirationTime > expirationTime) {
13361 node.expirationTime = expirationTime;
13362 }
13363 if (node.alternate !== null) {
13364 if (node.alternate.expirationTime === NoWork || node.alternate.expirationTime > expirationTime) {
13365 node.alternate.expirationTime = expirationTime;
13366 }
13367 }
13368 if (node['return'] === null) {
13369 if (node.tag === HostRoot) {
13370 var root = node.stateNode;
13371 if (!isWorking && nextRenderExpirationTime !== NoWork && expirationTime < nextRenderExpirationTime) {
13372 // This is an interruption. (Used for performance tracking.)
13373 interruptedBy = fiber;
13374 resetStack();
13375 }
13376 if (nextRoot !== root || !isWorking) {
13377 requestWork(root, expirationTime);
13378 }
13379 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
13380 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.');
13381 }
13382 } else {
13383 {
13384 if (!isErrorRecovery && fiber.tag === ClassComponent) {
13385 warnAboutUpdateOnUnmounted(fiber);
13386 }
13387 }
13388 return;
13389 }
13390 }
13391 node = node['return'];
13392 }
13393 }
13394
13395 function recalculateCurrentTime() {
13396 // 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