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

Function computeExpirationForFiber

code/event-handlers/public/app.js:12755–12797  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

12753 }
12754
12755 function computeExpirationForFiber(fiber) {
12756 var expirationTime = void 0;
12757 if (expirationContext !== NoWork) {
12758 // An explicit expiration context was set;
12759 expirationTime = expirationContext;
12760 } else if (isWorking) {
12761 if (isCommitting) {
12762 // Updates that occur during the commit phase should have sync priority
12763 // by default.
12764 expirationTime = Sync;
12765 } else {
12766 // Updates during the render phase should expire at the same time as
12767 // the work that is being rendered.
12768 expirationTime = nextRenderExpirationTime;
12769 }
12770 } else {
12771 // No explicit expiration context was set, and we're not currently
12772 // performing work. Calculate a new expiration time.
12773 if (fiber.mode & AsyncMode) {
12774 if (isBatchingInteractiveUpdates) {
12775 // This is an interactive update
12776 var currentTime = recalculateCurrentTime();
12777 expirationTime = computeInteractiveExpiration(currentTime);
12778 } else {
12779 // This is an async update
12780 var _currentTime = recalculateCurrentTime();
12781 expirationTime = computeAsyncExpiration(_currentTime);
12782 }
12783 } else {
12784 // This is a sync update
12785 expirationTime = Sync;
12786 }
12787 }
12788 if (isBatchingInteractiveUpdates) {
12789 // This is an interactive update. Keep track of the lowest pending
12790 // interactive expiration time. This allows us to synchronously flush
12791 // all interactive updates when needed.
12792 if (lowestPendingInteractiveExpirationTime === NoWork || expirationTime > lowestPendingInteractiveExpirationTime) {
12793 lowestPendingInteractiveExpirationTime = expirationTime;
12794 }
12795 }
12796 return expirationTime;
12797 }
12798
12799 function scheduleWork(fiber, expirationTime) {
12800 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