formatOwnerStack() — react Function Reference
Architecture documentation for the formatOwnerStack() function in ReactOwnerStackFrames.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 49d3bba9_cc0c_dc58_ea41_76e571ea2c0b["formatOwnerStack()"] 75e6c571_72a9_6770_1d7a_bda63166dba5["ReactOwnerStackFrames.js"] 49d3bba9_cc0c_dc58_ea41_76e571ea2c0b -->|defined in| 75e6c571_72a9_6770_1d7a_bda63166dba5 324c4ac3_e019_c3be_ed23_4066fa3a0522["describeDebugInfoFrame()"] 324c4ac3_e019_c3be_ed23_4066fa3a0522 -->|calls| 49d3bba9_cc0c_dc58_ea41_76e571ea2c0b style 49d3bba9_cc0c_dc58_ea41_76e571ea2c0b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shared/ReactOwnerStackFrames.js lines 12–41
export function formatOwnerStack(error: Error): string {
const prevPrepareStackTrace = Error.prepareStackTrace;
Error.prepareStackTrace = DefaultPrepareStackTrace;
let stack = error.stack;
Error.prepareStackTrace = prevPrepareStackTrace;
if (stack.startsWith('Error: react-stack-top-frame\n')) {
// V8's default formatting prefixes with the error message which we
// don't want/need.
stack = stack.slice(29);
}
let idx = stack.indexOf('\n');
if (idx !== -1) {
// Pop the JSX frame.
stack = stack.slice(idx + 1);
}
idx = stack.indexOf('react_stack_bottom_frame');
if (idx !== -1) {
idx = stack.lastIndexOf('\n', idx);
}
if (idx !== -1) {
// Cut off everything after the bottom frame since it'll be internals.
stack = stack.slice(0, idx);
} else {
// We didn't find any internal callsite out to user space.
// This means that this was called outside an owner or the owner is fully internal.
// To keep things light we exclude the entire trace in this case.
return '';
}
return stack;
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does formatOwnerStack() do?
formatOwnerStack() is a function in the react codebase, defined in packages/shared/ReactOwnerStackFrames.js.
Where is formatOwnerStack() defined?
formatOwnerStack() is defined in packages/shared/ReactOwnerStackFrames.js at line 12.
What calls formatOwnerStack()?
formatOwnerStack() is called by 1 function(s): describeDebugInfoFrame.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free