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

Function computeExpirationForFiber

code/composition/public/app.js:13563–13605  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

13561 }
13562
13563 function computeExpirationForFiber(fiber) {
13564 var expirationTime = void 0;
13565 if (expirationContext !== NoWork) {
13566 // An explicit expiration context was set;
13567 expirationTime = expirationContext;
13568 } else if (isWorking) {
13569 if (isCommitting) {
13570 // Updates that occur during the commit phase should have sync priority
13571 // by default.
13572 expirationTime = Sync;
13573 } else {
13574 // Updates during the render phase should expire at the same time as
13575 // the work that is being rendered.
13576 expirationTime = nextRenderExpirationTime;
13577 }
13578 } else {
13579 // No explicit expiration context was set, and we're not currently
13580 // performing work. Calculate a new expiration time.
13581 if (fiber.mode & AsyncMode) {
13582 if (isBatchingInteractiveUpdates) {
13583 // This is an interactive update
13584 var currentTime = recalculateCurrentTime();
13585 expirationTime = computeInteractiveExpiration(currentTime);
13586 } else {
13587 // This is an async update
13588 var _currentTime = recalculateCurrentTime();
13589 expirationTime = computeAsyncExpiration(_currentTime);
13590 }
13591 } else {
13592 // This is a sync update
13593 expirationTime = Sync;
13594 }
13595 }
13596 if (isBatchingInteractiveUpdates) {
13597 // This is an interactive update. Keep track of the lowest pending
13598 // interactive expiration time. This allows us to synchronously flush
13599 // all interactive updates when needed.
13600 if (lowestPendingInteractiveExpirationTime === NoWork || expirationTime > lowestPendingInteractiveExpirationTime) {
13601 lowestPendingInteractiveExpirationTime = expirationTime;
13602 }
13603 }
13604 return expirationTime;
13605 }
13606
13607 function scheduleWork(fiber, expirationTime) {
13608 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