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

Function computeExpirationForFiber

code/third-party/public/app.js:12658–12700  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

12656 }
12657
12658 function computeExpirationForFiber(fiber) {
12659 var expirationTime = void 0;
12660 if (expirationContext !== NoWork) {
12661 // An explicit expiration context was set;
12662 expirationTime = expirationContext;
12663 } else if (isWorking) {
12664 if (isCommitting) {
12665 // Updates that occur during the commit phase should have sync priority
12666 // by default.
12667 expirationTime = Sync;
12668 } else {
12669 // Updates during the render phase should expire at the same time as
12670 // the work that is being rendered.
12671 expirationTime = nextRenderExpirationTime;
12672 }
12673 } else {
12674 // No explicit expiration context was set, and we're not currently
12675 // performing work. Calculate a new expiration time.
12676 if (fiber.mode & AsyncMode) {
12677 if (isBatchingInteractiveUpdates) {
12678 // This is an interactive update
12679 var currentTime = recalculateCurrentTime();
12680 expirationTime = computeInteractiveExpiration(currentTime);
12681 } else {
12682 // This is an async update
12683 var _currentTime = recalculateCurrentTime();
12684 expirationTime = computeAsyncExpiration(_currentTime);
12685 }
12686 } else {
12687 // This is a sync update
12688 expirationTime = Sync;
12689 }
12690 }
12691 if (isBatchingInteractiveUpdates) {
12692 // This is an interactive update. Keep track of the lowest pending
12693 // interactive expiration time. This allows us to synchronously flush
12694 // all interactive updates when needed.
12695 if (lowestPendingInteractiveExpirationTime === NoWork || expirationTime > lowestPendingInteractiveExpirationTime) {
12696 lowestPendingInteractiveExpirationTime = expirationTime;
12697 }
12698 }
12699 return expirationTime;
12700 }
12701
12702 function scheduleWork(fiber, expirationTime) {
12703 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