commitPassiveUnmountOnFiber() — react Function Reference
Architecture documentation for the commitPassiveUnmountOnFiber() function in ReactFiberCommitWork.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 8ece8c7a_ae72_8f82_6cb2_654f8dc2bc90["commitPassiveUnmountOnFiber()"] e0fbfbd5_47b0_a489_0b36_bbfad9245544["ReactFiberCommitWork.js"] 8ece8c7a_ae72_8f82_6cb2_654f8dc2bc90 -->|defined in| e0fbfbd5_47b0_a489_0b36_bbfad9245544 ad28f4ae_d3f3_55f0_2c60_4744642c4b36["commitPassiveUnmountEffects()"] ad28f4ae_d3f3_55f0_2c60_4744642c4b36 -->|calls| 8ece8c7a_ae72_8f82_6cb2_654f8dc2bc90 e3c426a6_d017_fba5_0e94_3a1169983c80["recursivelyTraversePassiveUnmountEffects()"] e3c426a6_d017_fba5_0e94_3a1169983c80 -->|calls| 8ece8c7a_ae72_8f82_6cb2_654f8dc2bc90 4f76ed87_f151_2295_8bb4_c7b5dfe010a2["pushComponentEffectStart()"] 8ece8c7a_ae72_8f82_6cb2_654f8dc2bc90 -->|calls| 4f76ed87_f151_2295_8bb4_c7b5dfe010a2 da570743_1675_9fe9_6425_06d6a84f49ba["pushComponentEffectDuration()"] 8ece8c7a_ae72_8f82_6cb2_654f8dc2bc90 -->|calls| da570743_1675_9fe9_6425_06d6a84f49ba e3c426a6_d017_fba5_0e94_3a1169983c80["recursivelyTraversePassiveUnmountEffects()"] 8ece8c7a_ae72_8f82_6cb2_654f8dc2bc90 -->|calls| e3c426a6_d017_fba5_0e94_3a1169983c80 f1b730f8_6531_6ca3_ecc6_386e64652c07["commitHookPassiveUnmountEffects()"] 8ece8c7a_ae72_8f82_6cb2_654f8dc2bc90 -->|calls| f1b730f8_6531_6ca3_ecc6_386e64652c07 0173a090_1c78_3da9_68fd_5bfa21600acc["pushNestedEffectDurations()"] 8ece8c7a_ae72_8f82_6cb2_654f8dc2bc90 -->|calls| 0173a090_1c78_3da9_68fd_5bfa21600acc 006c62ff_dc21_a892_060f_b8af1c4c9d34["popNestedEffectDurations()"] 8ece8c7a_ae72_8f82_6cb2_654f8dc2bc90 -->|calls| 006c62ff_dc21_a892_060f_b8af1c4c9d34 2bc3a25f_8722_3ff5_8d20_3b3d595f7eda["bubbleNestedEffectDurations()"] 8ece8c7a_ae72_8f82_6cb2_654f8dc2bc90 -->|calls| 2bc3a25f_8722_3ff5_8d20_3b3d595f7eda style 8ece8c7a_ae72_8f82_6cb2_654f8dc2bc90 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-reconciler/src/ReactFiberCommitWork.js lines 4846–4938
function commitPassiveUnmountOnFiber(finishedWork: Fiber): void {
const prevEffectStart = pushComponentEffectStart();
const prevEffectDuration = pushComponentEffectDuration();
const prevEffectErrors = pushComponentEffectErrors();
const prevEffectDidSpawnUpdate = pushComponentEffectDidSpawnUpdate();
switch (finishedWork.tag) {
case FunctionComponent:
case ForwardRef:
case SimpleMemoComponent: {
recursivelyTraversePassiveUnmountEffects(finishedWork);
if (finishedWork.flags & Passive) {
commitHookPassiveUnmountEffects(
finishedWork,
finishedWork.return,
HookPassive | HookHasEffect,
);
}
break;
}
case HostRoot: {
const prevProfilerEffectDuration = pushNestedEffectDurations();
recursivelyTraversePassiveUnmountEffects(finishedWork);
if (enableProfilerTimer && enableProfilerCommitHooks) {
const finishedRoot: FiberRoot = finishedWork.stateNode;
finishedRoot.passiveEffectDuration += popNestedEffectDurations(
prevProfilerEffectDuration,
);
}
break;
}
case Profiler: {
const prevProfilerEffectDuration = pushNestedEffectDurations();
recursivelyTraversePassiveUnmountEffects(finishedWork);
if (enableProfilerTimer && enableProfilerCommitHooks) {
const profilerInstance = finishedWork.stateNode;
// Propagate layout effect durations to the next nearest Profiler ancestor.
// Do not reset these values until the next render so DevTools has a chance to read them first.
profilerInstance.passiveEffectDuration += bubbleNestedEffectDurations(
prevProfilerEffectDuration,
);
}
break;
}
case OffscreenComponent: {
const instance: OffscreenInstance = finishedWork.stateNode;
const nextState: OffscreenState | null = finishedWork.memoizedState;
const isHidden = nextState !== null;
if (
isHidden &&
instance._visibility & OffscreenPassiveEffectsConnected &&
// For backwards compatibility, don't unmount when a tree suspends. In
// the future we may change this to unmount after a delay.
(finishedWork.return === null ||
finishedWork.return.tag !== SuspenseComponent)
) {
// The effects are currently connected. Disconnect them.
// TODO: Add option or heuristic to delay before disconnecting the
// effects. Then if the tree reappears before the delay has elapsed, we
// can skip toggling the effects entirely.
instance._visibility &= ~OffscreenPassiveEffectsConnected;
recursivelyTraverseDisconnectPassiveEffects(finishedWork);
if (
enableProfilerTimer &&
enableProfilerCommitHooks &&
enableComponentPerformanceTrack &&
(finishedWork.mode & ProfileMode) !== NoMode &&
componentEffectStartTime >= 0 &&
componentEffectEndTime >= 0 &&
componentEffectEndTime - componentEffectStartTime > 0.05
) {
logComponentDisappeared(
finishedWork,
componentEffectStartTime,
componentEffectEndTime,
);
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does commitPassiveUnmountOnFiber() do?
commitPassiveUnmountOnFiber() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberCommitWork.js.
Where is commitPassiveUnmountOnFiber() defined?
commitPassiveUnmountOnFiber() is defined in packages/react-reconciler/src/ReactFiberCommitWork.js at line 4846.
What does commitPassiveUnmountOnFiber() call?
commitPassiveUnmountOnFiber() calls 7 function(s): bubbleNestedEffectDurations, commitHookPassiveUnmountEffects, popNestedEffectDurations, pushComponentEffectDuration, pushComponentEffectStart, pushNestedEffectDurations, recursivelyTraversePassiveUnmountEffects.
What calls commitPassiveUnmountOnFiber()?
commitPassiveUnmountOnFiber() is called by 2 function(s): commitPassiveUnmountEffects, recursivelyTraversePassiveUnmountEffects.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free