Home / Function/ resetSuspendedComponent() — react Function Reference

resetSuspendedComponent() — react Function Reference

Architecture documentation for the resetSuspendedComponent() function in ReactFiberThrow.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  193cd750_beab_a60e_f635_6d131342856b["resetSuspendedComponent()"]
  2945bdb1_d075_d792_a028_13eee518c9d4["ReactFiberThrow.js"]
  193cd750_beab_a60e_f635_6d131342856b -->|defined in| 2945bdb1_d075_d792_a028_13eee518c9d4
  f933a08e_fb14_205d_b7b1_ce3073b61e36["throwException()"]
  f933a08e_fb14_205d_b7b1_ce3073b61e36 -->|calls| 193cd750_beab_a60e_f635_6d131342856b
  style 193cd750_beab_a60e_f635_6d131342856b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberThrow.js lines 203–239

function resetSuspendedComponent(sourceFiber: Fiber, rootRenderLanes: Lanes) {
  const currentSourceFiber = sourceFiber.alternate;
  if (currentSourceFiber !== null) {
    // Since we never visited the children of the suspended component, we
    // need to propagate the context change now, to ensure that we visit
    // them during the retry.
    //
    // We don't have to do this for errors because we retry errors without
    // committing in between. So this is specific to Suspense.
    propagateParentContextChangesToDeferredTree(
      currentSourceFiber,
      sourceFiber,
      rootRenderLanes,
    );
  }

  // Reset the memoizedState to what it was before we attempted to render it.
  // A legacy mode Suspense quirk, only relevant to hook components.
  const tag = sourceFiber.tag;
  if (
    !disableLegacyMode &&
    (sourceFiber.mode & ConcurrentMode) === NoMode &&
    (tag === FunctionComponent ||
      tag === ForwardRef ||
      tag === SimpleMemoComponent)
  ) {
    const currentSource = sourceFiber.alternate;
    if (currentSource) {
      sourceFiber.updateQueue = currentSource.updateQueue;
      sourceFiber.memoizedState = currentSource.memoizedState;
      sourceFiber.lanes = currentSource.lanes;
    } else {
      sourceFiber.updateQueue = null;
      sourceFiber.memoizedState = null;
    }
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does resetSuspendedComponent() do?
resetSuspendedComponent() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberThrow.js.
Where is resetSuspendedComponent() defined?
resetSuspendedComponent() is defined in packages/react-reconciler/src/ReactFiberThrow.js at line 203.
What calls resetSuspendedComponent()?
resetSuspendedComponent() is called by 1 function(s): throwException.

Analyze Your Own Codebase

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

Try Supermodel Free