describeAncestors() — react Function Reference
Architecture documentation for the describeAncestors() function in validateDOMNesting.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 330a083b_035c_adf8_6bc7_857221a6c608["describeAncestors()"] 99b6f05f_c8d3_afa4_842b_34ebebb1f8a7["validateDOMNesting.js"] 330a083b_035c_adf8_6bc7_857221a6c608 -->|defined in| 99b6f05f_c8d3_afa4_842b_34ebebb1f8a7 96e5c4d9_bcbf_86ea_69bb_cc3d02fbd794["validateDOMNesting()"] 96e5c4d9_bcbf_86ea_69bb_cc3d02fbd794 -->|calls| 330a083b_035c_adf8_6bc7_857221a6c608 9805d2a0_a12e_fb58_a873_c63b02425b81["validateTextNesting()"] 9805d2a0_a12e_fb58_a873_c63b02425b81 -->|calls| 330a083b_035c_adf8_6bc7_857221a6c608 style 330a083b_035c_adf8_6bc7_857221a6c608 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-dom-bindings/src/client/validateDOMNesting.js lines 26–55
function describeAncestors(
ancestor: Fiber,
child: Fiber,
props: null | {children: null},
): string {
let fiber: null | Fiber = child;
let node: null | HydrationDiffNode = null;
let distanceFromLeaf = 0;
while (fiber) {
if (fiber === ancestor) {
distanceFromLeaf = 0;
}
node = {
fiber: fiber,
children: node !== null ? [node] : [],
serverProps:
fiber === child ? props : fiber === ancestor ? null : undefined,
serverTail: [],
distanceFromLeaf: distanceFromLeaf,
};
distanceFromLeaf++;
fiber = fiber.return;
}
if (node !== null) {
// Describe the node using the hydration diff logic.
// Replace + with - to mark ancestor and child. It's kind of arbitrary.
return describeDiff(node).replaceAll(/^[+-]/gm, '>');
}
return '';
}
Domain
Subdomains
Source
Frequently Asked Questions
What does describeAncestors() do?
describeAncestors() is a function in the react codebase, defined in packages/react-dom-bindings/src/client/validateDOMNesting.js.
Where is describeAncestors() defined?
describeAncestors() is defined in packages/react-dom-bindings/src/client/validateDOMNesting.js at line 26.
What calls describeAncestors()?
describeAncestors() is called by 2 function(s): validateDOMNesting, validateTextNesting.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free