Home / Function/ claimHydratableSingleton() — react Function Reference

claimHydratableSingleton() — react Function Reference

Architecture documentation for the claimHydratableSingleton() function in ReactFiberHydrationContext.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  73a9e7ed_1281_819e_047c_f2d46a8df791["claimHydratableSingleton()"]
  4bc7109f_638d_d9f7_bf47_6ec55b2fa128["ReactFiberHydrationContext.js"]
  73a9e7ed_1281_819e_047c_f2d46a8df791 -->|defined in| 4bc7109f_638d_d9f7_bf47_6ec55b2fa128
  53f55fda_e2b6_2801_4fbc_525f8828d23d["updateHostRoot()"]
  53f55fda_e2b6_2801_4fbc_525f8828d23d -->|calls| 73a9e7ed_1281_819e_047c_f2d46a8df791
  caaf30b2_6e58_ce4e_f73c_baa2c3b083d0["getRootHostContainer()"]
  73a9e7ed_1281_819e_047c_f2d46a8df791 -->|calls| caaf30b2_6e58_ce4e_f73c_baa2c3b083d0
  950cf4f4_84e4_d7d6_01b0_f2c00f238dae["getHostContext()"]
  73a9e7ed_1281_819e_047c_f2d46a8df791 -->|calls| 950cf4f4_84e4_d7d6_01b0_f2c00f238dae
  0a0d4387_d230_00e3_0763_8da5f624b610["buildHydrationDiffNode()"]
  73a9e7ed_1281_819e_047c_f2d46a8df791 -->|calls| 0a0d4387_d230_00e3_0763_8da5f624b610
  style 73a9e7ed_1281_819e_047c_f2d46a8df791 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberHydrationContext.js lines 405–443

function claimHydratableSingleton(fiber: Fiber): void {
  if (supportsSingletons) {
    if (!isHydrating) {
      return;
    }
    const currentRootContainer = getRootHostContainer();
    const currentHostContext = getHostContext();
    const instance = (fiber.stateNode = resolveSingletonInstance(
      fiber.type,
      fiber.pendingProps,
      currentRootContainer,
      currentHostContext,
      false,
    ));

    if (__DEV__) {
      if (!didSuspendOrErrorDEV) {
        const differences = diffHydratedPropsForDevWarnings(
          instance,
          fiber.type,
          fiber.pendingProps,
          currentHostContext,
        );
        if (differences !== null) {
          const diffNode = buildHydrationDiffNode(fiber, 0);
          diffNode.serverProps = differences;
        }
      }
    }

    hydrationParentFiber = fiber;
    rootOrSingletonContext = true;
    nextHydratableInstance = getFirstHydratableChildWithinSingleton(
      fiber.type,
      instance,
      nextHydratableInstance,
    );
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does claimHydratableSingleton() do?
claimHydratableSingleton() is a function in the react codebase, defined in packages/react-reconciler/src/ReactFiberHydrationContext.js.
Where is claimHydratableSingleton() defined?
claimHydratableSingleton() is defined in packages/react-reconciler/src/ReactFiberHydrationContext.js at line 405.
What does claimHydratableSingleton() call?
claimHydratableSingleton() calls 3 function(s): buildHydrationDiffNode, getHostContext, getRootHostContainer.
What calls claimHydratableSingleton()?
claimHydratableSingleton() is called by 1 function(s): updateHostRoot.

Analyze Your Own Codebase

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

Try Supermodel Free