mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
[DevTools] Fix display of stack frames with anonymous sources (#34237)
This commit is contained in:
parent
0bc71e67ab
commit
03fda05d2c
|
|
@ -52,8 +52,8 @@ function parseStackTraceFromChromeStack(
|
|||
if (filename === '<anonymous>') {
|
||||
filename = '';
|
||||
}
|
||||
const line = +(parsed[3] || parsed[6]);
|
||||
const col = +(parsed[4] || parsed[7]);
|
||||
const line = +(parsed[3] || parsed[6] || 0);
|
||||
const col = +(parsed[4] || parsed[7] || 0);
|
||||
parsedFrames.push([name, filename, line, col, 0, 0, isAsync]);
|
||||
}
|
||||
return parsedFrames;
|
||||
|
|
@ -235,6 +235,7 @@ function collectStackTrace(
|
|||
// at name (filename:0:0)
|
||||
// at filename:0:0
|
||||
// at async filename:0:0
|
||||
// at Array.map (<anonymous>)
|
||||
const chromeFrameRegExp =
|
||||
/^ *at (?:(.+) \((?:(.+):(\d+):(\d+)|\<anonymous\>)\)|(?:async )?(.+):(\d+):(\d+)|\<anonymous\>)$/;
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ export function CallSiteView({
|
|||
return (
|
||||
<div className={styles.CallSite}>
|
||||
{functionName || virtualFunctionName}
|
||||
{url !== '' && (
|
||||
<>
|
||||
{' @ '}
|
||||
<span
|
||||
className={linkIsEnabled ? styles.Link : null}
|
||||
|
|
@ -70,6 +72,9 @@ export function CallSiteView({
|
|||
title={url + ':' + line}>
|
||||
{formatLocationForDisplay(url, line, column)}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
|
||||
<ElementBadges environmentName={environmentName} />
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -40,5 +40,9 @@ export default function formatLocationForDisplay(
|
|||
}
|
||||
}
|
||||
|
||||
if (line === 0) {
|
||||
return nameOnly;
|
||||
}
|
||||
|
||||
return `${nameOnly}:${line}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user