Home / Function/ commitOffscreenPassiveMountEffects() — react Function Reference

commitOffscreenPassiveMountEffects() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2d036adb_abc2_6b17_a780_276a2848fe77["commitOffscreenPassiveMountEffects()"]
  e0fbfbd5_47b0_a489_0b36_bbfad9245544["ReactFiberCommitWork.js"]
  2d036adb_abc2_6b17_a780_276a2848fe77 -->|defined in| e0fbfbd5_47b0_a489_0b36_bbfad9245544
  07f3c6d9_2fce_51ae_4408_e0d4ab7359a1["commitPassiveMountOnFiber()"]
  07f3c6d9_2fce_51ae_4408_e0d4ab7359a1 -->|calls| 2d036adb_abc2_6b17_a780_276a2848fe77
  c3c0c008_f543_54ba_5f17_334454e50793["reconnectPassiveEffects()"]
  c3c0c008_f543_54ba_5f17_334454e50793 -->|calls| 2d036adb_abc2_6b17_a780_276a2848fe77
  4ec30fe0_df47_e5db_0cf4_f03d14801fdc["commitAtomicPassiveEffects()"]
  4ec30fe0_df47_e5db_0cf4_f03d14801fdc -->|calls| 2d036adb_abc2_6b17_a780_276a2848fe77
  9b153302_815a_1f5e_73cd_e59240aaf8f6["retainCache()"]
  2d036adb_abc2_6b17_a780_276a2848fe77 -->|calls| 9b153302_815a_1f5e_73cd_e59240aaf8f6
  403ebde6_eb4f_5227_0cbf_8f26881eabc7["releaseCache()"]
  2d036adb_abc2_6b17_a780_276a2848fe77 -->|calls| 403ebde6_eb4f_5227_0cbf_8f26881eabc7
  9038121f_d5c3_1155_3e13_4e82bdfe1e42["commitTransitionProgress()"]
  2d036adb_abc2_6b17_a780_276a2848fe77 -->|calls| 9038121f_d5c3_1155_3e13_4e82bdfe1e42
  style 2d036adb_abc2_6b17_a780_276a2848fe77 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberCommitWork.js lines 3358–3452

function commitOffscreenPassiveMountEffects(
  current: Fiber | null,
  finishedWork: Fiber,
  instance: OffscreenInstance,
) {
  let previousCache: Cache | null = null;
  if (
    current !== null &&
    current.memoizedState !== null &&
    current.memoizedState.cachePool !== null
  ) {
    previousCache = current.memoizedState.cachePool.pool;
  }
  let nextCache: Cache | null = null;
  if (
    finishedWork.memoizedState !== null &&
    finishedWork.memoizedState.cachePool !== null
  ) {
    nextCache = finishedWork.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 (nextCache !== previousCache) {
    if (nextCache != null) {
      retainCache(nextCache);
    }
    if (previousCache != null) {
      releaseCache(previousCache);
    }
  }

  if (enableTransitionTracing) {
    // TODO: Pre-rendering should not be counted as part of a transition. We
    // may add separate logs for pre-rendering, but it's not part of the
    // primary metrics.
    const offscreenState: OffscreenState = finishedWork.memoizedState;
    const queue: OffscreenQueue | null = (finishedWork.updateQueue: any);

    const isHidden = offscreenState !== null;
    if (queue !== null) {
      if (isHidden) {
        const transitions = queue.transitions;
        if (transitions !== null) {
          transitions.forEach(transition => {
            // Add all the transitions saved in the update queue during
            // the render phase (ie the transitions associated with this boundary)
            // into the transitions set.
            if (instance._transitions === null) {
              instance._transitions = new Set();
            }
            instance._transitions.add(transition);
          });
        }

        const markerInstances = queue.markerInstances;
        if (markerInstances !== null) {
          markerInstances.forEach(markerInstance => {
            const markerTransitions = markerInstance.transitions;
            // There should only be a few tracing marker transitions because
            // they should be only associated with the transition that
            // caused them
            if (markerTransitions !== null) {
              markerTransitions.forEach(transition => {
                if (instance._transitions === null) {
                  instance._transitions = new Set();
                } else if (instance._transitions.has(transition)) {
                  if (markerInstance.pendingBoundaries === null) {
                    markerInstance.pendingBoundaries = new Map();
                  }
                  if (instance._pendingMarkers === null) {
                    instance._pendingMarkers = new Set();
                  }

                  instance._pendingMarkers.add(markerInstance);
                }
              });
            }
          });
        }

Domain

Subdomains

Frequently Asked Questions

What does commitOffscreenPassiveMountEffects() do?
commitOffscreenPassiveMountEffects() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberCommitWork.js.
Where is commitOffscreenPassiveMountEffects() defined?
commitOffscreenPassiveMountEffects() is defined in packages/react-reconciler/src/ReactFiberCommitWork.js at line 3358.
What does commitOffscreenPassiveMountEffects() call?
commitOffscreenPassiveMountEffects() calls 3 function(s): commitTransitionProgress, releaseCache, retainCache.
What calls commitOffscreenPassiveMountEffects()?
commitOffscreenPassiveMountEffects() is called by 3 function(s): commitAtomicPassiveEffects, commitPassiveMountOnFiber, reconnectPassiveEffects.

Analyze Your Own Codebase

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

Try Supermodel Free