Home / Function/ updateSuspenseListComponent() — react Function Reference

updateSuspenseListComponent() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  52177215_eced_b9dc_62cc_32297ae94438["updateSuspenseListComponent()"]
  0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"]
  52177215_eced_b9dc_62cc_32297ae94438 -->|defined in| 0be70812_cc0c_b210_f84f_8e61dd5f831c
  235e1db1_02a4_912f_7d82_ea6636c850c0["beginWork()"]
  235e1db1_02a4_912f_7d82_ea6636c850c0 -->|calls| 52177215_eced_b9dc_62cc_32297ae94438
  e0222a62_06f5_558d_4e5d_d834d25ce250["pushSuspenseListContext()"]
  52177215_eced_b9dc_62cc_32297ae94438 -->|calls| e0222a62_06f5_558d_4e5d_d834d25ce250
  4cf196ce_ffa9_10e5_640c_01c2be0e9d2d["hasSuspenseListContext()"]
  52177215_eced_b9dc_62cc_32297ae94438 -->|calls| 4cf196ce_ffa9_10e5_640c_01c2be0e9d2d
  a38c6d95_272d_004f_208e_2b5640266860["setShallowSuspenseListContext()"]
  52177215_eced_b9dc_62cc_32297ae94438 -->|calls| a38c6d95_272d_004f_208e_2b5640266860
  7a74d7c7_a60b_d855_4210_5ede9b35da95["setDefaultShallowSuspenseListContext()"]
  52177215_eced_b9dc_62cc_32297ae94438 -->|calls| 7a74d7c7_a60b_d855_4210_5ede9b35da95
  24f4b623_aeaa_2bf1_eff1_8d4d145e0f62["validateSuspenseListChildren()"]
  52177215_eced_b9dc_62cc_32297ae94438 -->|calls| 24f4b623_aeaa_2bf1_eff1_8d4d145e0f62
  5a02665d_9cf5_08a4_8eb7_eb88f892d98d["reverseChildren()"]
  52177215_eced_b9dc_62cc_32297ae94438 -->|calls| 5a02665d_9cf5_08a4_8eb7_eb88f892d98d
  cf5641cc_b89e_d6b2_5d40_41ad5bbdd682["reconcileChildren()"]
  52177215_eced_b9dc_62cc_32297ae94438 -->|calls| cf5641cc_b89e_d6b2_5d40_41ad5bbdd682
  dae8f65a_04a5_194b_7c97_c4819e519207["getIsHydrating()"]
  52177215_eced_b9dc_62cc_32297ae94438 -->|calls| dae8f65a_04a5_194b_7c97_c4819e519207
  1da57ff0_4ff1_c9eb_b5e4_92617b9e5d40["propagateSuspenseContextChange()"]
  52177215_eced_b9dc_62cc_32297ae94438 -->|calls| 1da57ff0_4ff1_c9eb_b5e4_92617b9e5d40
  32e6fbfa_241f_9cf6_c4bd_0114ea6e38a3["findLastContentRow()"]
  52177215_eced_b9dc_62cc_32297ae94438 -->|calls| 32e6fbfa_241f_9cf6_c4bd_0114ea6e38a3
  cdd36a09_6908_5990_b1c1_9486c83cd5d4["initSuspenseListRenderState()"]
  52177215_eced_b9dc_62cc_32297ae94438 -->|calls| cdd36a09_6908_5990_b1c1_9486c83cd5d4
  style 52177215_eced_b9dc_62cc_32297ae94438 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberBeginWork.js lines 3383–3564

function updateSuspenseListComponent(
  current: Fiber | null,
  workInProgress: Fiber,
  renderLanes: Lanes,
) {
  const nextProps: SuspenseListProps = workInProgress.pendingProps;
  const revealOrder: SuspenseListRevealOrder = nextProps.revealOrder;
  const tailMode: SuspenseListTailMode = nextProps.tail;
  const newChildren = nextProps.children;

  let suspenseContext: SuspenseContext = suspenseStackCursor.current;

  if (workInProgress.flags & DidCapture) {
    // This is the second pass after having suspended in a row. Proceed directly
    // to the complete phase.
    pushSuspenseListContext(workInProgress, suspenseContext);
    return null;
  }

  const shouldForceFallback = hasSuspenseListContext(
    suspenseContext,
    (ForceSuspenseFallback: SuspenseContext),
  );
  if (shouldForceFallback) {
    suspenseContext = setShallowSuspenseListContext(
      suspenseContext,
      ForceSuspenseFallback,
    );
    workInProgress.flags |= DidCapture;
  } else {
    suspenseContext = setDefaultShallowSuspenseListContext(suspenseContext);
  }
  pushSuspenseListContext(workInProgress, suspenseContext);

  validateRevealOrder(revealOrder);
  validateTailOptions(tailMode, revealOrder);
  validateSuspenseListChildren(newChildren, revealOrder);

  if (revealOrder === 'backwards' && current !== null) {
    // For backwards the current mounted set will be backwards. Reconciling against it
    // will lead to mismatches and reorders. We need to swap the original set first
    // and then restore it afterwards.
    reverseChildren(current);
    reconcileChildren(current, workInProgress, newChildren, renderLanes);
    reverseChildren(current);
  } else {
    reconcileChildren(current, workInProgress, newChildren, renderLanes);
  }
  // Read how many children forks this set pushed so we can push it every time we retry.
  const treeForkCount = getIsHydrating() ? getForksAtLevel(workInProgress) : 0;

  if (!shouldForceFallback) {
    const didSuspendBefore =
      current !== null && (current.flags & DidCapture) !== NoFlags;
    if (didSuspendBefore) {
      // If we previously forced a fallback, we need to schedule work
      // on any nested boundaries to let them know to try to render
      // again. This is the same as context updating.
      propagateSuspenseContextChange(
        workInProgress,
        workInProgress.child,
        renderLanes,
      );
    }
  }

  if (!disableLegacyMode && (workInProgress.mode & ConcurrentMode) === NoMode) {
    // In legacy mode, SuspenseList doesn't work so we just
    // use make it a noop by treating it as the default revealOrder.
    workInProgress.memoizedState = null;
  } else {
    switch (revealOrder) {
      case 'backwards': {
        // We're going to find the first row that has existing content.
        // We are also going to reverse the order of anything in the existing content
        // since we want to actually render them backwards from the reconciled set.
        // The tail is left in order, because it'll be added to the front as we
        // complete each item.
        const lastContentRow = findLastContentRow(workInProgress.child);
        let tail;
        if (lastContentRow === null) {

Domain

Subdomains

Called By

Frequently Asked Questions

What does updateSuspenseListComponent() do?
updateSuspenseListComponent() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberBeginWork.js.
Where is updateSuspenseListComponent() defined?
updateSuspenseListComponent() is defined in packages/react-reconciler/src/ReactFiberBeginWork.js at line 3383.
What does updateSuspenseListComponent() call?
updateSuspenseListComponent() calls 11 function(s): findLastContentRow, getIsHydrating, hasSuspenseListContext, initSuspenseListRenderState, propagateSuspenseContextChange, pushSuspenseListContext, reconcileChildren, reverseChildren, and 3 more.
What calls updateSuspenseListComponent()?
updateSuspenseListComponent() is called by 1 function(s): beginWork.

Analyze Your Own Codebase

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

Try Supermodel Free