Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Meta
create-react-app
Commits
b25c1339
Commit
b25c1339
authored
7 years ago
by
Dan Abramov
Committed by
GitHub
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Skip React frames that are too close (#2143)
parent
76d2d848
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/react-error-overlay/src/utils/warnings.js
+15
-0
packages/react-error-overlay/src/utils/warnings.js
with
15 additions
and
0 deletions
+15
-0
packages/react-error-overlay/src/utils/warnings.js
+
15
-
0
View file @
b25c1339
...
@@ -13,11 +13,26 @@ function massage(
...
@@ -13,11 +13,26 @@ function massage(
// Reassemble the stack with full filenames provided by React
// Reassemble the stack with full filenames provided by React
let
stack
=
''
;
let
stack
=
''
;
let
lastFilename
;
let
lastLineNumber
;
for
(
let
index
=
0
;
index
<
frames
.
length
;
++
index
)
{
for
(
let
index
=
0
;
index
<
frames
.
length
;
++
index
)
{
const
{
fileName
,
lineNumber
}
=
frames
[
index
];
const
{
fileName
,
lineNumber
}
=
frames
[
index
];
if
(
fileName
==
null
||
lineNumber
==
null
)
{
if
(
fileName
==
null
||
lineNumber
==
null
)
{
continue
;
continue
;
}
}
// TODO: instead, collapse them in the UI
if
(
fileName
===
lastFilename
&&
typeof
lineNumber
===
'
number
'
&&
typeof
lastLineNumber
===
'
number
'
&&
Math
.
abs
(
lineNumber
-
lastLineNumber
)
<
3
)
{
continue
;
}
lastFilename
=
fileName
;
lastLineNumber
=
lineNumber
;
let
{
functionName
}
=
frames
[
index
];
let
{
functionName
}
=
frames
[
index
];
functionName
=
functionName
||
'
(anonymous function)
'
;
functionName
=
functionName
||
'
(anonymous function)
'
;
stack
+=
`in
${
functionName
}
(at
${
fileName
}
:
${
lineNumber
}
)\n`
;
stack
+=
`in
${
functionName
}
(at
${
fileName
}
:
${
lineNumber
}
)\n`
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets