Home / Function/ updateDehydratedActivityComponent() — react Function Reference

updateDehydratedActivityComponent() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e42a80e0_6c61_140d_2260_b8b8319dc664["updateDehydratedActivityComponent()"]
  0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"]
  e42a80e0_6c61_140d_2260_b8b8319dc664 -->|defined in| 0be70812_cc0c_b210_f84f_8e61dd5f831c
  7ace11c1_e82a_4a1b_c698_6bb1566f0ae0["updateActivityComponent()"]
  7ace11c1_e82a_4a1b_c698_6bb1566f0ae0 -->|calls| e42a80e0_6c61_140d_2260_b8b8319dc664
  c4dcccd0_c675_5cd8_8dbb_749fd21c187a["pushDehydratedActivitySuspenseHandler()"]
  e42a80e0_6c61_140d_2260_b8b8319dc664 -->|calls| c4dcccd0_c675_5cd8_8dbb_749fd21c187a
  a4082647_57a0_a4c2_d6f0_4e94beb28e99["warnIfHydrating()"]
  e42a80e0_6c61_140d_2260_b8b8319dc664 -->|calls| a4082647_57a0_a4c2_d6f0_4e94beb28e99
  b02f5205_6c96_0d34_5a3b_8331d512b06c["retryActivityComponentWithoutHydrating()"]
  e42a80e0_6c61_140d_2260_b8b8319dc664 -->|calls| b02f5205_6c96_0d34_5a3b_8331d512b06c
  c943a7d8_232f_81a5_13b7_d2afc6a913e3["reenterHydrationStateFromDehydratedActivityInstance()"]
  e42a80e0_6c61_140d_2260_b8b8319dc664 -->|calls| c943a7d8_232f_81a5_13b7_d2afc6a913e3
  6e745d66_1946_5b98_1eeb_037e1c878b67["mountActivityChildren()"]
  e42a80e0_6c61_140d_2260_b8b8319dc664 -->|calls| 6e745d66_1946_5b98_1eeb_037e1c878b67
  style e42a80e0_6c61_140d_2260_b8b8319dc664 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberBeginWork.js lines 975–1118

function updateDehydratedActivityComponent(
  current: Fiber,
  workInProgress: Fiber,
  didSuspend: boolean,
  nextProps: ActivityProps,
  activityInstance: ActivityInstance,
  activityState: ActivityState,
  renderLanes: Lanes,
): null | Fiber {
  // We'll handle suspending since if something suspends we can just leave
  // it dehydrated. We push early and then pop if we enter non-dehydrated attempts.
  pushDehydratedActivitySuspenseHandler(workInProgress);
  if (!didSuspend) {
    // This is the first render pass. Attempt to hydrate.

    // We should never be hydrating at this point because it is the first pass,
    // but after we've already committed once.
    warnIfHydrating();

    if (includesSomeLane(renderLanes, (OffscreenLane: Lane))) {
      // 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);
    }

    if (
      // TODO: Factoring is a little weird, since we check this right below, too.
      !didReceiveUpdate
    ) {
      // We need to check if any children have context before we decide to bail
      // out, so propagate the changes now.
      lazilyPropagateParentContextChanges(current, workInProgress, renderLanes);
    }

    // We use lanes to indicate that a child might depend on context, so if
    // any context has changed, we need to treat is as if the input might have changed.
    const hasContextChanged = includesSomeLane(renderLanes, current.childLanes);
    if (didReceiveUpdate || hasContextChanged) {
      // This boundary has changed since the first render. This means that we are now unable to
      // hydrate it. We might still be able to hydrate it using a higher priority lane.
      const root = getWorkInProgressRoot();
      if (root !== null) {
        const attemptHydrationAtLane = getBumpedLaneForHydration(
          root,
          renderLanes,
        );
        if (
          attemptHydrationAtLane !== NoLane &&
          attemptHydrationAtLane !== activityState.retryLane
        ) {
          // Intentionally mutating since this render will get interrupted. This
          // is one of the very rare times where we mutate the current tree
          // during the render phase.
          activityState.retryLane = attemptHydrationAtLane;
          enqueueConcurrentRenderForLane(current, attemptHydrationAtLane);
          scheduleUpdateOnFiber(root, current, attemptHydrationAtLane);

          // Throw a special object that signals to the work loop that it should
          // interrupt the current render.
          //
          // Because we're inside a React-only execution stack, we don't
          // strictly need to throw here — we could instead modify some internal
          // work loop state. But using an exception means we don't need to
          // check for this case on every iteration of the work loop. So doing
          // it this way moves the check out of the fast path.
          throw SelectiveHydrationException;
        } else {
          // We have already tried to ping at a higher priority than we're rendering with
          // so if we got here, we must have failed to hydrate at those levels. We must
          // now give up. Instead, we're going to delete the whole subtree and instead inject
          // a new real Activity boundary to take its place. This might suspend for a while
          // and if it does we might still have an opportunity to hydrate before this pass
          // commits.
        }
      }

      // If we did not selectively hydrate, we'll continue rendering without
      // hydrating. Mark this tree as suspended to prevent it from committing
      // outside a transition.
      //

Domain

Subdomains

Frequently Asked Questions

What does updateDehydratedActivityComponent() do?
updateDehydratedActivityComponent() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberBeginWork.js.
Where is updateDehydratedActivityComponent() defined?
updateDehydratedActivityComponent() is defined in packages/react-reconciler/src/ReactFiberBeginWork.js at line 975.
What does updateDehydratedActivityComponent() call?
updateDehydratedActivityComponent() calls 5 function(s): mountActivityChildren, pushDehydratedActivitySuspenseHandler, reenterHydrationStateFromDehydratedActivityInstance, retryActivityComponentWithoutHydrating, warnIfHydrating.
What calls updateDehydratedActivityComponent()?
updateDehydratedActivityComponent() is called by 1 function(s): updateActivityComponent.

Analyze Your Own Codebase

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

Try Supermodel Free