Home / Function/ updateActivityComponent() — react Function Reference

updateActivityComponent() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  7ace11c1_e82a_4a1b_c698_6bb1566f0ae0["updateActivityComponent()"]
  0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"]
  7ace11c1_e82a_4a1b_c698_6bb1566f0ae0 -->|defined in| 0be70812_cc0c_b210_f84f_8e61dd5f831c
  235e1db1_02a4_912f_7d82_ea6636c850c0["beginWork()"]
  235e1db1_02a4_912f_7d82_ea6636c850c0 -->|calls| 7ace11c1_e82a_4a1b_c698_6bb1566f0ae0
  dae8f65a_04a5_194b_7c97_c4819e519207["getIsHydrating()"]
  7ace11c1_e82a_4a1b_c698_6bb1566f0ae0 -->|calls| dae8f65a_04a5_194b_7c97_c4819e519207
  6e745d66_1946_5b98_1eeb_037e1c878b67["mountActivityChildren()"]
  7ace11c1_e82a_4a1b_c698_6bb1566f0ae0 -->|calls| 6e745d66_1946_5b98_1eeb_037e1c878b67
  219a3239_d833_17eb_948a_bef7724b5517["bailoutOffscreenComponent()"]
  7ace11c1_e82a_4a1b_c698_6bb1566f0ae0 -->|calls| 219a3239_d833_17eb_948a_bef7724b5517
  c4dcccd0_c675_5cd8_8dbb_749fd21c187a["pushDehydratedActivitySuspenseHandler()"]
  7ace11c1_e82a_4a1b_c698_6bb1566f0ae0 -->|calls| c4dcccd0_c675_5cd8_8dbb_749fd21c187a
  55fdf17d_33e7_f55c_d2de_3d6f42a3be84["claimNextHydratableActivityInstance()"]
  7ace11c1_e82a_4a1b_c698_6bb1566f0ae0 -->|calls| 55fdf17d_33e7_f55c_d2de_3d6f42a3be84
  ccc8b502_3e7b_a95f_b43a_641c646f1930["mountDehydratedActivityComponent()"]
  7ace11c1_e82a_4a1b_c698_6bb1566f0ae0 -->|calls| ccc8b502_3e7b_a95f_b43a_641c646f1930
  e42a80e0_6c61_140d_2260_b8b8319dc664["updateDehydratedActivityComponent()"]
  7ace11c1_e82a_4a1b_c698_6bb1566f0ae0 -->|calls| e42a80e0_6c61_140d_2260_b8b8319dc664
  34d657a1_f8c8_f0b5_e2d8_cba9518e0da2["updateWorkInProgressOffscreenFiber()"]
  7ace11c1_e82a_4a1b_c698_6bb1566f0ae0 -->|calls| 34d657a1_f8c8_f0b5_e2d8_cba9518e0da2
  style 7ace11c1_e82a_4a1b_c698_6bb1566f0ae0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberBeginWork.js lines 1120–1211

function updateActivityComponent(
  current: null | Fiber,
  workInProgress: Fiber,
  renderLanes: Lanes,
) {
  const nextProps: ActivityProps = workInProgress.pendingProps;

  // Check if the first pass suspended.
  const didSuspend = (workInProgress.flags & DidCapture) !== NoFlags;
  workInProgress.flags &= ~DidCapture;

  if (current === null) {
    // Initial mount

    // Special path for hydration
    // If we're currently hydrating, try to hydrate this boundary.
    // Hidden Activity boundaries are not emitted on the server.
    if (getIsHydrating()) {
      if (nextProps.mode === 'hidden') {
        // SSR doesn't render hidden Activity so it shouldn't hydrate,
        // even at offscreen lane. Defer to a client rendered offscreen lane.
        const primaryChildFragment = mountActivityChildren(
          workInProgress,
          nextProps,
          renderLanes,
        );
        workInProgress.lanes = laneToLanes(OffscreenLane);
        return bailoutOffscreenComponent(null, primaryChildFragment);
      } else {
        // We must push the suspense handler context *before* attempting to
        // hydrate, to avoid a mismatch in case it errors.
        pushDehydratedActivitySuspenseHandler(workInProgress);
        const dehydrated: ActivityInstance =
          claimNextHydratableActivityInstance(workInProgress);
        return mountDehydratedActivityComponent(
          workInProgress,
          dehydrated,
          renderLanes,
        );
      }
    }

    return mountActivityChildren(workInProgress, nextProps, renderLanes);
  } else {
    // This is an update.

    // Special path for hydration
    const prevState: null | ActivityState = current.memoizedState;

    if (prevState !== null) {
      const dehydrated = prevState.dehydrated;
      return updateDehydratedActivityComponent(
        current,
        workInProgress,
        didSuspend,
        nextProps,
        dehydrated,
        prevState,
        renderLanes,
      );
    }

    const currentChild: Fiber = (current.child: any);

    const nextChildren = nextProps.children;
    const nextMode = nextProps.mode;
    const offscreenChildProps: OffscreenProps = {
      mode: nextMode,
      children: nextChildren,
    };

    if (
      includesSomeLane(renderLanes, (OffscreenLane: Lane)) &&
      includesSomeLane(renderLanes, current.lanes)
    ) {
      // If we're rendering Offscreen and we're entering the activity then it's possible
      // that the only reason we rendered was because this boundary left work. Provide
      // it as a cause if another one doesn't already exist.
      markRenderDerivedCause(workInProgress);
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does updateActivityComponent() do?
updateActivityComponent() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberBeginWork.js.
Where is updateActivityComponent() defined?
updateActivityComponent() is defined in packages/react-reconciler/src/ReactFiberBeginWork.js at line 1120.
What does updateActivityComponent() call?
updateActivityComponent() calls 8 function(s): bailoutOffscreenComponent, claimNextHydratableActivityInstance, getIsHydrating, mountActivityChildren, mountDehydratedActivityComponent, pushDehydratedActivitySuspenseHandler, updateDehydratedActivityComponent, updateWorkInProgressOffscreenFiber.
What calls updateActivityComponent()?
updateActivityComponent() 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