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

Function computeExpirationForFiber

code/styling/public/app.js:13425–13467  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

13423 }
13424
13425 function computeExpirationForFiber(fiber) {
13426 var expirationTime = void 0;
13427 if (expirationContext !== NoWork) {
13428 // An explicit expiration context was set;
13429 expirationTime = expirationContext;
13430 } else if (isWorking) {
13431 if (isCommitting) {
13432 // Updates that occur during the commit phase should have sync priority
13433 // by default.
13434 expirationTime = Sync;
13435 } else {
13436 // Updates during the render phase should expire at the same time as
13437 // the work that is being rendered.
13438 expirationTime = nextRenderExpirationTime;
13439 }
13440 } else {
13441 // No explicit expiration context was set, and we're not currently
13442 // performing work. Calculate a new expiration time.
13443 if (fiber.mode & AsyncMode) {
13444 if (isBatchingInteractiveUpdates) {
13445 // This is an interactive update
13446 var currentTime = recalculateCurrentTime();
13447 expirationTime = computeInteractiveExpiration(currentTime);
13448 } else {
13449 // This is an async update
13450 var _currentTime = recalculateCurrentTime();
13451 expirationTime = computeAsyncExpiration(_currentTime);
13452 }
13453 } else {
13454 // This is a sync update
13455 expirationTime = Sync;
13456 }
13457 }
13458 if (isBatchingInteractiveUpdates) {
13459 // This is an interactive update. Keep track of the lowest pending
13460 // interactive expiration time. This allows us to synchronously flush
13461 // all interactive updates when needed.
13462 if (lowestPendingInteractiveExpirationTime === NoWork || expirationTime > lowestPendingInteractiveExpirationTime) {
13463 lowestPendingInteractiveExpirationTime = expirationTime;
13464 }
13465 }
13466 return expirationTime;
13467 }
13468
13469 function scheduleWork(fiber, expirationTime) {
13470 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