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

Function computeExpirationForFiber

code/redux/public/app.js:13676–13718  ·  view source on GitHub ↗
(fiber)

Source from the content-addressed store, hash-verified

13674 }
13675
13676 function computeExpirationForFiber(fiber) {
13677 var expirationTime = void 0;
13678 if (expirationContext !== NoWork) {
13679 // An explicit expiration context was set;
13680 expirationTime = expirationContext;
13681 } else if (isWorking) {
13682 if (isCommitting) {
13683 // Updates that occur during the commit phase should have sync priority
13684 // by default.
13685 expirationTime = Sync;
13686 } else {
13687 // Updates during the render phase should expire at the same time as
13688 // the work that is being rendered.
13689 expirationTime = nextRenderExpirationTime;
13690 }
13691 } else {
13692 // No explicit expiration context was set, and we're not currently
13693 // performing work. Calculate a new expiration time.
13694 if (fiber.mode & AsyncMode) {
13695 if (isBatchingInteractiveUpdates) {
13696 // This is an interactive update
13697 var currentTime = recalculateCurrentTime();
13698 expirationTime = computeInteractiveExpiration(currentTime);
13699 } else {
13700 // This is an async update
13701 var _currentTime = recalculateCurrentTime();
13702 expirationTime = computeAsyncExpiration(_currentTime);
13703 }
13704 } else {
13705 // This is a sync update
13706 expirationTime = Sync;
13707 }
13708 }
13709 if (isBatchingInteractiveUpdates) {
13710 // This is an interactive update. Keep track of the lowest pending
13711 // interactive expiration time. This allows us to synchronously flush
13712 // all interactive updates when needed.
13713 if (lowestPendingInteractiveExpirationTime === NoWork || expirationTime > lowestPendingInteractiveExpirationTime) {
13714 lowestPendingInteractiveExpirationTime = expirationTime;
13715 }
13716 }
13717 return expirationTime;
13718 }
13719
13720 function scheduleWork(fiber, expirationTime) {
13721 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