Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
690f89de
Unverified
Commit
690f89de
authored
Feb 25, 2025
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Feb 25, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev-overlay] Add indicator when sourcemapping fails (#76516)
parent
d46d3efd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
+33
-3
call-stack-frame.tsx
...erlay/ui/components/call-stack-frame/call-stack-frame.tsx
+11
-3
external.tsx
...client/components/react-dev-overlay/ui/icons/external.tsx
+20
-0
next-test-utils.ts
test/lib/next-test-utils.ts
+2
-0
No files found.
packages/next/src/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.tsx
View file @
690f89de
...
@@ -2,7 +2,7 @@ import type { StackFrame } from 'next/dist/compiled/stacktrace-parser'
...
@@ -2,7 +2,7 @@ import type { StackFrame } from 'next/dist/compiled/stacktrace-parser'
import
type
{
OriginalStackFrame
}
from
'../../../utils/stack-frame'
import
type
{
OriginalStackFrame
}
from
'../../../utils/stack-frame'
import
{
HotlinkedText
}
from
'../hot-linked-text'
import
{
HotlinkedText
}
from
'../hot-linked-text'
import
{
ExternalIcon
}
from
'../../icons/external'
import
{
ExternalIcon
,
SourceMappingErrorIcon
}
from
'../../icons/external'
import
{
getFrameSource
}
from
'../../../utils/stack-frame'
import
{
getFrameSource
}
from
'../../../utils/stack-frame'
import
{
useOpenInEditor
}
from
'../../utils/use-open-in-editor'
import
{
useOpenInEditor
}
from
'../../utils/use-open-in-editor'
...
@@ -11,7 +11,6 @@ export const CallStackFrame: React.FC<{
...
@@ -11,7 +11,6 @@ export const CallStackFrame: React.FC<{
index
:
number
index
:
number
}
>
=
function
CallStackFrame
({
frame
,
index
})
{
}
>
=
function
CallStackFrame
({
frame
,
index
})
{
// TODO: ability to expand resolved frames
// TODO: ability to expand resolved frames
// TODO: render error or external indicator
const
f
:
StackFrame
=
frame
.
originalStackFrame
??
frame
.
sourceStackFrame
const
f
:
StackFrame
=
frame
.
originalStackFrame
??
frame
.
sourceStackFrame
const
hasSource
=
Boolean
(
frame
.
originalCodeFrame
)
const
hasSource
=
Boolean
(
frame
.
originalCodeFrame
)
...
@@ -57,6 +56,15 @@ export const CallStackFrame: React.FC<{
...
@@ -57,6 +56,15 @@ export const CallStackFrame: React.FC<{
<
ExternalIcon
width=
{
16
}
height=
{
16
}
/>
<
ExternalIcon
width=
{
16
}
height=
{
16
}
/>
</
button
>
</
button
>
)
}
)
}
{
frame
.
error
?
(
<
button
className=
"source-mapping-error-button"
onClick=
{
()
=>
console
.
error
(
frame
.
reason
)
}
title=
"Sourcemapping failed. Click to log cause of error."
>
<
SourceMappingErrorIcon
width=
{
16
}
height=
{
16
}
/>
</
button
>
)
:
null
}
</
div
>
</
div
>
<
span
<
span
className=
"call-stack-frame-file-source"
className=
"call-stack-frame-file-source"
...
@@ -114,7 +122,7 @@ export const CALL_STACK_FRAME_STYLES = `
...
@@ -114,7 +122,7 @@ export const CALL_STACK_FRAME_STYLES = `
}
}
}
}
.open-in-editor-button {
.open-in-editor-button
, .source-mapping-error-button
{
display: flex;
display: flex;
align-items: center;
align-items: center;
justify-content: center;
justify-content: center;
...
...
packages/next/src/client/components/react-dev-overlay/ui/icons/external.tsx
View file @
690f89de
...
@@ -17,3 +17,23 @@ export function ExternalIcon(props: React.SVGProps<SVGSVGElement>) {
...
@@ -17,3 +17,23 @@ export function ExternalIcon(props: React.SVGProps<SVGSVGElement>) {
</
svg
>
</
svg
>
)
)
}
}
export
function
SourceMappingErrorIcon
(
props
:
React
.
SVGProps
<
SVGSVGElement
>
)
{
return
(
<
svg
xmlns=
"http://www.w3.org/2000/svg"
height=
"16"
strokeLinejoin=
"round"
viewBox=
"-4 -4 24 24"
width=
"16"
{
...
props
}
>
<
path
fillRule=
"evenodd"
clipRule=
"evenodd"
d=
"M8.55846 2H7.44148L1.88975 13.5H14.1102L8.55846 2ZM9.90929 1.34788C9.65902 0.829456 9.13413 0.5 8.55846 0.5H7.44148C6.86581 0.5 6.34092 0.829454 6.09065 1.34787L0.192608 13.5653C-0.127943 14.2293 0.355835 15 1.09316 15H14.9068C15.6441 15 16.1279 14.2293 15.8073 13.5653L9.90929 1.34788ZM8.74997 4.75V5.5V8V8.75H7.24997V8V5.5V4.75H8.74997ZM7.99997 12C8.55226 12 8.99997 11.5523 8.99997 11C8.99997 10.4477 8.55226 10 7.99997 10C7.44769 10 6.99997 10.4477 6.99997 11C6.99997 11.5523 7.44769 12 7.99997 12Z"
fill=
"currentColor"
></
path
>
</
svg
>
)
}
test/lib/next-test-utils.ts
View file @
690f89de
...
@@ -1439,6 +1439,8 @@ export async function getRedboxCallStack(
...
@@ -1439,6 +1439,8 @@ export async function getRedboxCallStack(
// so that c&p automatically does the right thing.
// so that c&p automatically does the right thing.
const
frame
=
frameElement
.
innerText
.
replace
(
'
\
n'
,
' '
)
const
frame
=
frameElement
.
innerText
.
replace
(
'
\
n'
,
' '
)
// TODO: Special marker if source-mapping fails.
// Feel free to adjust this heuristic if it accidentally hides too much.
// Feel free to adjust this heuristic if it accidentally hides too much.
const
isInternalFrame
=
const
isInternalFrame
=
// likely https://linear.app/vercel/issue/NDX-464
// likely https://linear.app/vercel/issue/NDX-464
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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