Home / Function/ commitPassiveUnmountInsideDeletedTreeOnFiber() — react Function Reference

commitPassiveUnmountInsideDeletedTreeOnFiber() — react Function Reference

Architecture documentation for the commitPassiveUnmountInsideDeletedTreeOnFiber() function in ReactFiberCommitWork.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  19b7647a_1cb8_04c7_c5f0_d84f212da7c7["commitPassiveUnmountInsideDeletedTreeOnFiber()"]
  e0fbfbd5_47b0_a489_0b36_bbfad9245544["ReactFiberCommitWork.js"]
  19b7647a_1cb8_04c7_c5f0_d84f212da7c7 -->|defined in| e0fbfbd5_47b0_a489_0b36_bbfad9245544
  729871c3_3107_8e90_f4db_d567db865b85["commitPassiveUnmountEffectsInsideOfDeletedTree_begin()"]
  729871c3_3107_8e90_f4db_d567db865b85 -->|calls| 19b7647a_1cb8_04c7_c5f0_d84f212da7c7
  4f76ed87_f151_2295_8bb4_c7b5dfe010a2["pushComponentEffectStart()"]
  19b7647a_1cb8_04c7_c5f0_d84f212da7c7 -->|calls| 4f76ed87_f151_2295_8bb4_c7b5dfe010a2
  da570743_1675_9fe9_6425_06d6a84f49ba["pushComponentEffectDuration()"]
  19b7647a_1cb8_04c7_c5f0_d84f212da7c7 -->|calls| da570743_1675_9fe9_6425_06d6a84f49ba
  f1b730f8_6531_6ca3_ecc6_386e64652c07["commitHookPassiveUnmountEffects()"]
  19b7647a_1cb8_04c7_c5f0_d84f212da7c7 -->|calls| f1b730f8_6531_6ca3_ecc6_386e64652c07
  403ebde6_eb4f_5227_0cbf_8f26881eabc7["releaseCache()"]
  19b7647a_1cb8_04c7_c5f0_d84f212da7c7 -->|calls| 403ebde6_eb4f_5227_0cbf_8f26881eabc7
  9b153302_815a_1f5e_73cd_e59240aaf8f6["retainCache()"]
  19b7647a_1cb8_04c7_c5f0_d84f212da7c7 -->|calls| 9b153302_815a_1f5e_73cd_e59240aaf8f6
  9122110e_e4df_7275_b4ee_a3a5f62365dc["abortParentMarkerTransitionsForDeletedFiber()"]
  19b7647a_1cb8_04c7_c5f0_d84f212da7c7 -->|calls| 9122110e_e4df_7275_b4ee_a3a5f62365dc
  ff9409a2_b556_06af_85c9_ee748a528d80["popComponentEffectStart()"]
  19b7647a_1cb8_04c7_c5f0_d84f212da7c7 -->|calls| ff9409a2_b556_06af_85c9_ee748a528d80
  e047b0ab_3567_71e4_0705_344ee07a23b7["popComponentEffectDuration()"]
  19b7647a_1cb8_04c7_c5f0_d84f212da7c7 -->|calls| e047b0ab_3567_71e4_0705_344ee07a23b7
  style 19b7647a_1cb8_04c7_c5f0_d84f212da7c7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberCommitWork.js lines 5126–5268

function commitPassiveUnmountInsideDeletedTreeOnFiber(
  current: Fiber,
  nearestMountedAncestor: Fiber | null,
): void {
  const prevEffectStart = pushComponentEffectStart();
  const prevEffectDuration = pushComponentEffectDuration();
  const prevEffectErrors = pushComponentEffectErrors();
  const prevEffectDidSpawnUpdate = pushComponentEffectDidSpawnUpdate();
  switch (current.tag) {
    case FunctionComponent:
    case ForwardRef:
    case SimpleMemoComponent: {
      commitHookPassiveUnmountEffects(
        current,
        nearestMountedAncestor,
        HookPassive,
      );
      break;
    }
    // TODO: run passive unmount effects when unmounting a root.
    // Because passive unmount effects are not currently run,
    // the cache instance owned by the root will never be freed.
    // When effects are run, the cache should be freed here:
    // case HostRoot: {
    //   const cache = current.memoizedState.cache;
    //   releaseCache(cache);
    //   break;
    // }
    case LegacyHiddenComponent:
    case OffscreenComponent: {
      if (
        current.memoizedState !== null &&
        current.memoizedState.cachePool !== null
      ) {
        const cache: Cache = current.memoizedState.cachePool.pool;
        // Retain/release the cache used for pending (suspended) nodes.
        // Note that this is only reached in the non-suspended/visible case:
        // when the content is suspended/hidden, the retain/release occurs
        // via the parent Suspense component (see case above).
        if (cache != null) {
          retainCache(cache);
        }
      }
      break;
    }
    case SuspenseComponent: {
      if (enableTransitionTracing) {
        // We need to mark this fiber's parents as deleted
        const offscreenFiber: Fiber = (current.child: any);
        const instance: OffscreenInstance = offscreenFiber.stateNode;
        const transitions = instance._transitions;
        if (transitions !== null) {
          const abortReason: TransitionAbort = {
            reason: 'suspense',
            name: current.memoizedProps.name || null,
          };
          if (
            current.memoizedState === null ||
            current.memoizedState.dehydrated === null
          ) {
            abortParentMarkerTransitionsForDeletedFiber(
              offscreenFiber,
              abortReason,
              transitions,
              instance,
              true,
            );

            if (nearestMountedAncestor !== null) {
              abortParentMarkerTransitionsForDeletedFiber(
                nearestMountedAncestor,
                abortReason,
                transitions,
                instance,
                false,
              );
            }
          }
        }
      }
      break;

Domain

Subdomains

Frequently Asked Questions

What does commitPassiveUnmountInsideDeletedTreeOnFiber() do?
commitPassiveUnmountInsideDeletedTreeOnFiber() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberCommitWork.js.
Where is commitPassiveUnmountInsideDeletedTreeOnFiber() defined?
commitPassiveUnmountInsideDeletedTreeOnFiber() is defined in packages/react-reconciler/src/ReactFiberCommitWork.js at line 5126.
What does commitPassiveUnmountInsideDeletedTreeOnFiber() call?
commitPassiveUnmountInsideDeletedTreeOnFiber() calls 8 function(s): abortParentMarkerTransitionsForDeletedFiber, commitHookPassiveUnmountEffects, popComponentEffectDuration, popComponentEffectStart, pushComponentEffectDuration, pushComponentEffectStart, releaseCache, retainCache.
What calls commitPassiveUnmountInsideDeletedTreeOnFiber()?
commitPassiveUnmountInsideDeletedTreeOnFiber() is called by 1 function(s): commitPassiveUnmountEffectsInsideOfDeletedTree_begin.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free