Skip to content

Commit a8001e9

Browse files
committed
Be resilient to prepareStackTrace being set while parsing
1 parent d73e4b3 commit a8001e9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/react-devtools-shared/src/backend/DevToolsOwnerStack.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ function filterDebugStack(error: Error): string {
2121
// to save bandwidth even in DEV. We'll also replay these stacks on the client so by
2222
// stripping them early we avoid that overhead. Otherwise we'd normally just rely on
2323
// the DevTools or framework's ignore lists to filter them out.
24+
const prevPrepareStackTrace = Error.prepareStackTrace;
25+
// $FlowFixMe[incompatible-type] It does accept undefined.
26+
Error.prepareStackTrace = undefined;
2427
let stack = error.stack;
28+
Error.prepareStackTrace = prevPrepareStackTrace;
2529
if (stack.startsWith('Error: react-stack-top-frame\n')) {
2630
// V8's default formatting prefixes with the error message which we
2731
// don't want/need.

0 commit comments

Comments
 (0)