Skip to content

Commit 5f2b571

Browse files
authored
[DevTools] Filter out built-in stack frames (facebook#34828)
Treat fake eval anonymous stacks as built-in. Hide built-in stack frames unless they're used to call into a non-ignored stack frame. The two main things to fix here is that 1) we're showing a linkified stack for fake anonymous and 2) we're showing only built-ins when the stack is completely internal. Meaning framework code is all noise.
1 parent 56e8469 commit 5f2b571

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

packages/react-devtools-shared/src/devtools/views/Components/StackTraceView.css

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
padding: 0.25rem;
33
}
44

5-
.CallSite, .IgnoredCallSite {
5+
.CallSite {
66
display: block;
77
padding-left: 1rem;
88
}
99

10-
.IgnoredCallSite {
11-
opacity: 0.5;
10+
.IgnoredCallSite, .BuiltInCallSite {
11+
display: none;
12+
}
13+
14+
.CallSite + .BuiltInCallSite {
15+
display: block;
1216
}
1317

1418
.Link {

packages/react-devtools-shared/src/devtools/views/Components/StackTraceView.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,22 @@ export function CallSiteView({
6060
symbolicatedCallSite !== null ? symbolicatedCallSite.location : callSite;
6161
const ignored =
6262
symbolicatedCallSite !== null ? symbolicatedCallSite.ignored : false;
63-
if (ignored) {
64-
// TODO: Make an option to be able to toggle the display of ignore listed rows.
65-
// Ideally this UI should be higher than a single Stack Trace so that there's not
66-
// multiple buttons in a single inspection taking up space.
67-
return null;
68-
}
63+
// TODO: Make an option to be able to toggle the display of ignore listed rows.
64+
// Ideally this UI should be higher than a single Stack Trace so that there's not
65+
// multiple buttons in a single inspection taking up space.
66+
67+
const isBuiltIn = url === '' || url.startsWith('<anonymous>'); // This looks like a fake anonymous through eval.
6968
return (
70-
<div className={ignored ? styles.IgnoredCallSite : styles.CallSite}>
69+
<div
70+
className={
71+
ignored
72+
? styles.IgnoredCallSite
73+
: isBuiltIn
74+
? styles.BuiltInCallSite
75+
: styles.CallSite
76+
}>
7177
{functionName || virtualFunctionName}
72-
{url !== '' && (
78+
{!isBuiltIn && (
7379
<>
7480
{' @ '}
7581
<span

0 commit comments

Comments
 (0)