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

Function computeExpirationForFiber

code/communication/public/app.js:13460–13502  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

13458 }
13459
13460 function computeExpirationForFiber(fiber) {
13461 var expirationTime = void 0;
13462 if (expirationContext !== NoWork) {
13463 // An explicit expiration context was set;
13464 expirationTime = expirationContext;
13465 } else if (isWorking) {
13466 if (isCommitting) {
13467 // Updates that occur during the commit phase should have sync priority
13468 // by default.
13469 expirationTime = Sync;
13470 } else {
13471 // Updates during the render phase should expire at the same time as
13472 // the work that is being rendered.
13473 expirationTime = nextRenderExpirationTime;
13474 }
13475 } else {
13476 // No explicit expiration context was set, and we're not currently
13477 // performing work. Calculate a new expiration time.
13478 if (fiber.mode & AsyncMode) {
13479 if (isBatchingInteractiveUpdates) {
13480 // This is an interactive update
13481 var currentTime = recalculateCurrentTime();
13482 expirationTime = computeInteractiveExpiration(currentTime);
13483 } else {
13484 // This is an async update
13485 var _currentTime = recalculateCurrentTime();
13486 expirationTime = computeAsyncExpiration(_currentTime);
13487 }
13488 } else {
13489 // This is a sync update
13490 expirationTime = Sync;
13491 }
13492 }
13493 if (isBatchingInteractiveUpdates) {
13494 // This is an interactive update. Keep track of the lowest pending
13495 // interactive expiration time. This allows us to synchronously flush
13496 // all interactive updates when needed.
13497 if (lowestPendingInteractiveExpirationTime === NoWork || expirationTime > lowestPendingInteractiveExpirationTime) {
13498 lowestPendingInteractiveExpirationTime = expirationTime;
13499 }
13500 }
13501 return expirationTime;
13502 }
13503
13504 function scheduleWork(fiber, expirationTime) {
13505 return scheduleWorkImpl(fiber, expirationTime, false);

Callers 2

ReactFiberClassComponentFunction · 0.70
ReactFiberReconciler$1Function · 0.70

Calls 3

recalculateCurrentTimeFunction · 0.70
computeAsyncExpirationFunction · 0.70

Tested by

no test coverage detected