Home / Function/ deferHiddenOffscreenComponent() — react Function Reference

deferHiddenOffscreenComponent() — react Function Reference

Architecture documentation for the deferHiddenOffscreenComponent() function in ReactFiberBeginWork.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  9667b43a_5b5c_621a_f700_b7578247ef20["deferHiddenOffscreenComponent()"]
  0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"]
  9667b43a_5b5c_621a_f700_b7578247ef20 -->|defined in| 0be70812_cc0c_b210_f84f_8e61dd5f831c
  526a99f2_4938_2b27_2b9e_a0a59903cdb5["updateOffscreenComponent()"]
  526a99f2_4938_2b27_2b9e_a0a59903cdb5 -->|calls| 9667b43a_5b5c_621a_f700_b7578247ef20
  bd22193d_8474_6563_1d9d_425de4fe8986["reuseHiddenContextOnStack()"]
  9667b43a_5b5c_621a_f700_b7578247ef20 -->|calls| bd22193d_8474_6563_1d9d_425de4fe8986
  992f4e57_663a_57fc_8711_c7a964a2cb1c["pushOffscreenSuspenseHandler()"]
  9667b43a_5b5c_621a_f700_b7578247ef20 -->|calls| 992f4e57_663a_57fc_8711_c7a964a2cb1c
  style 9667b43a_5b5c_621a_f700_b7578247ef20 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberBeginWork.js lines 826–870

function deferHiddenOffscreenComponent(
  current: Fiber | null,
  workInProgress: Fiber,
  nextBaseLanes: Lanes,
  renderLanes: Lanes,
  remainingChildLanes: Lanes,
) {
  const nextState: OffscreenState = {
    baseLanes: nextBaseLanes,
    // Save the cache pool so we can resume later.
    cachePool: getOffscreenDeferredCache(),
  };
  workInProgress.memoizedState = nextState;
  // push the cache pool even though we're going to bail out
  // because otherwise there'd be a context mismatch
  if (current !== null) {
    pushTransition(workInProgress, null, null);
  }

  // We're about to bail out, but we need to push this to the stack anyway
  // to avoid a push/pop misalignment.
  reuseHiddenContextOnStack(workInProgress);

  pushOffscreenSuspenseHandler(workInProgress);

  if (current !== null) {
    // Since this tree will resume rendering in a separate render, we need
    // to propagate parent contexts now so we don't lose track of which
    // ones changed.
    propagateParentContextChangesToDeferredTree(
      current,
      workInProgress,
      renderLanes,
    );
  }

  // We override the remaining child lanes to be the subset that we computed
  // on the outside. We need to do this after propagating the context
  // because propagateParentContextChangesToDeferredTree may schedule
  // work which bubbles all the way up to the root and updates our child lanes.
  // We want to dismiss that since we're not going to work on it yet.
  workInProgress.childLanes = remainingChildLanes;

  return null;
}

Domain

Subdomains

Frequently Asked Questions

What does deferHiddenOffscreenComponent() do?
deferHiddenOffscreenComponent() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberBeginWork.js.
Where is deferHiddenOffscreenComponent() defined?
deferHiddenOffscreenComponent() is defined in packages/react-reconciler/src/ReactFiberBeginWork.js at line 826.
What does deferHiddenOffscreenComponent() call?
deferHiddenOffscreenComponent() calls 2 function(s): pushOffscreenSuspenseHandler, reuseHiddenContextOnStack.
What calls deferHiddenOffscreenComponent()?
deferHiddenOffscreenComponent() is called by 1 function(s): updateOffscreenComponent.

Analyze Your Own Codebase

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

Try Supermodel Free