Home / Function/ clientRenderBoundary() — react Function Reference

clientRenderBoundary() — react Function Reference

Architecture documentation for the clientRenderBoundary() function in ReactDOMFizzInstructionSetShared.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  7d1084e1_bc3c_a493_7b17_46d96c160ecc["clientRenderBoundary()"]
  2a61726f_9a35_9713_662f_bfb1ef81f49f["ReactDOMFizzInstructionSetShared.js"]
  7d1084e1_bc3c_a493_7b17_46d96c160ecc -->|defined in| 2a61726f_9a35_9713_662f_bfb1ef81f49f
  style 7d1084e1_bc3c_a493_7b17_46d96c160ecc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetShared.js lines 366–394

export function clientRenderBoundary(
  suspenseBoundaryID,
  errorDigest,
  errorMsg,
  errorStack,
  errorComponentStack,
) {
  // Find the fallback's first element.
  const suspenseIdNode = document.getElementById(suspenseBoundaryID);
  if (!suspenseIdNode) {
    // The user must have already navigated away from this tree.
    // E.g. because the parent was hydrated.
    return;
  }
  // Find the boundary around the fallback. This is always the previous node.
  const suspenseNode = suspenseIdNode.previousSibling;
  // Tag it to be client rendered.
  suspenseNode.data = SUSPENSE_FALLBACK_START_DATA;
  // assign error metadata to first sibling
  const dataset = suspenseIdNode.dataset;
  if (errorDigest) dataset['dgst'] = errorDigest;
  if (errorMsg) dataset['msg'] = errorMsg;
  if (errorStack) dataset['stck'] = errorStack;
  if (errorComponentStack) dataset['cstck'] = errorComponentStack;
  // Tell React to retry it if the parent already hydrated.
  if (suspenseNode['_reactRetry']) {
    suspenseNode['_reactRetry']();
  }
}

Domain

Subdomains

Frequently Asked Questions

What does clientRenderBoundary() do?
clientRenderBoundary() is a function in the react codebase, defined in packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetShared.js.
Where is clientRenderBoundary() defined?
clientRenderBoundary() is defined in packages/react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSetShared.js at line 366.

Analyze Your Own Codebase

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

Try Supermodel Free