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

Function computeExpirationForFiber

code/new-context-api/public/app.js:12786–12828  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

12784 }
12785
12786 function computeExpirationForFiber(fiber) {
12787 var expirationTime = void 0;
12788 if (expirationContext !== NoWork) {
12789 // An explicit expiration context was set;
12790 expirationTime = expirationContext;
12791 } else if (isWorking) {
12792 if (isCommitting) {
12793 // Updates that occur during the commit phase should have sync priority
12794 // by default.
12795 expirationTime = Sync;
12796 } else {
12797 // Updates during the render phase should expire at the same time as
12798 // the work that is being rendered.
12799 expirationTime = nextRenderExpirationTime;
12800 }
12801 } else {
12802 // No explicit expiration context was set, and we're not currently
12803 // performing work. Calculate a new expiration time.
12804 if (fiber.mode & AsyncMode) {
12805 if (isBatchingInteractiveUpdates) {
12806 // This is an interactive update
12807 var currentTime = recalculateCurrentTime();
12808 expirationTime = computeInteractiveExpiration(currentTime);
12809 } else {
12810 // This is an async update
12811 var _currentTime = recalculateCurrentTime();
12812 expirationTime = computeAsyncExpiration(_currentTime);
12813 }
12814 } else {
12815 // This is a sync update
12816 expirationTime = Sync;
12817 }
12818 }
12819 if (isBatchingInteractiveUpdates) {
12820 // This is an interactive update. Keep track of the lowest pending
12821 // interactive expiration time. This allows us to synchronously flush
12822 // all interactive updates when needed.
12823 if (lowestPendingInteractiveExpirationTime === NoWork || expirationTime > lowestPendingInteractiveExpirationTime) {
12824 lowestPendingInteractiveExpirationTime = expirationTime;
12825 }
12826 }
12827 return expirationTime;
12828 }
12829
12830 function scheduleWork(fiber, expirationTime) {
12831 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