getOwnerStackByComponentInfoInDev() — react Function Reference
Architecture documentation for the getOwnerStackByComponentInfoInDev() function in ReactComponentInfoStack.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 2d433b0e_4a33_a1aa_23b9_0c0523ef14e0["getOwnerStackByComponentInfoInDev()"] fc2707c9_28bf_6212_3c95_549c8c89a1df["ReactComponentInfoStack.js"] 2d433b0e_4a33_a1aa_23b9_0c0523ef14e0 -->|defined in| fc2707c9_28bf_6212_3c95_549c8c89a1df style 2d433b0e_4a33_a1aa_23b9_0c0523ef14e0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shared/ReactComponentInfoStack.js lines 16–53
export function getOwnerStackByComponentInfoInDev(
componentInfo: ReactComponentInfo,
): string {
if (!__DEV__) {
return '';
}
try {
let info = '';
// The owner stack of the current component will be where it was created, i.e. inside its owner.
// There's no actual name of the currently executing component. Instead, that is available
// on the regular stack that's currently executing. However, if there is no owner at all, then
// there's no stack frame so we add the name of the root component to the stack to know which
// component is currently executing.
if (!componentInfo.owner && typeof componentInfo.name === 'string') {
return describeBuiltInComponentFrame(componentInfo.name);
}
let owner: void | null | ReactComponentInfo = componentInfo;
while (owner) {
const ownerStack: ?Error = owner.debugStack;
if (ownerStack != null) {
// Server Component
owner = owner.owner;
if (owner) {
// TODO: Should we stash this somewhere for caching purposes?
info += '\n' + formatOwnerStack(ownerStack);
}
} else {
break;
}
}
return info;
} catch (x) {
return '\nError generating stack: ' + x.message + '\n' + x.stack;
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does getOwnerStackByComponentInfoInDev() do?
getOwnerStackByComponentInfoInDev() is a function in the react codebase, defined in packages/shared/ReactComponentInfoStack.js.
Where is getOwnerStackByComponentInfoInDev() defined?
getOwnerStackByComponentInfoInDev() is defined in packages/shared/ReactComponentInfoStack.js at line 16.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free