mirror of
https://github.com/facebook/react.git
synced 2026-02-22 20:01:52 +00:00
Update test and stack frame code to support newer V8 stack formats (#22477)
This commit is contained in:
@@ -168,7 +168,15 @@ export function describeNativeComponentFrame(
|
||||
// The next one that isn't the same should be our match though.
|
||||
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
||||
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
||||
const frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
|
||||
let frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
|
||||
|
||||
// If our component frame is labeled "<anonymous>"
|
||||
// but we have a user-provided "displayName"
|
||||
// splice it in to make the stack more readable.
|
||||
if (fn.displayName && frame.includes('<anonymous>')) {
|
||||
frame = frame.replace('<anonymous>', fn.displayName);
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
if (typeof fn === 'function') {
|
||||
componentFrameCache.set(fn, frame);
|
||||
|
||||
Reference in New Issue
Block a user