ReactOwnerStackFrames.js — react Source File
Architecture documentation for ReactOwnerStackFrames.js, a javascript file in the react codebase. 1 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 75e6c571_72a9_6770_1d7a_bda63166dba5["ReactOwnerStackFrames.js"] ce7f6081_62bc_1c40_b730_35e812e5376d["DefaultPrepareStackTrace"] 75e6c571_72a9_6770_1d7a_bda63166dba5 --> ce7f6081_62bc_1c40_b730_35e812e5376d 823a67e4_24d9_f152_2b72_4a49ef93fd70["ReactComponentStackFrame.js"] 823a67e4_24d9_f152_2b72_4a49ef93fd70 --> 75e6c571_72a9_6770_1d7a_bda63166dba5 style 75e6c571_72a9_6770_1d7a_bda63166dba5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import DefaultPrepareStackTrace from 'shared/DefaultPrepareStackTrace';
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
Functions
Dependencies
- DefaultPrepareStackTrace
Imported By
Source
Frequently Asked Questions
What does ReactOwnerStackFrames.js do?
ReactOwnerStackFrames.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in ReactOwnerStackFrames.js?
ReactOwnerStackFrames.js defines 1 function(s): formatOwnerStack.
What does ReactOwnerStackFrames.js depend on?
ReactOwnerStackFrames.js imports 1 module(s): DefaultPrepareStackTrace.
What files import ReactOwnerStackFrames.js?
ReactOwnerStackFrames.js is imported by 1 file(s): ReactComponentStackFrame.js.
Where is ReactOwnerStackFrames.js in the architecture?
ReactOwnerStackFrames.js is located at packages/shared/ReactOwnerStackFrames.js (domain: BabelCompiler, subdomain: Entrypoint, directory: packages/shared).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free