Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error Overlay] Comprehensive refinement #75471

Merged
merged 90 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
e76f4c0
overlay wip
raunofreiberg Jan 28, 2025
5aad57e
Merge branch 'canary' of github.com:vercel/next.js into rf/errors-ove…
raunofreiberg Jan 29, 2025
c1e608a
wip
raunofreiberg Jan 29, 2025
f3099b0
many fixes
raunofreiberg Jan 30, 2025
1ffd693
fix animation height
raunofreiberg Jan 30, 2025
fd20ef8
cleanup
raunofreiberg Jan 30, 2025
ed8066a
align turbo border
raunofreiberg Jan 30, 2025
e5d531d
Update call-stack-frame.tsx
raunofreiberg Jan 30, 2025
12fad68
Remove svg
raunofreiberg Jan 30, 2025
08e5e85
add app img
raunofreiberg Jan 30, 2025
8e83f15
Update next-logo.tsx
raunofreiberg Jan 30, 2025
d55a2ff
add animation
raunofreiberg Jan 30, 2025
95f41b0
fix Escape
raunofreiberg Jan 30, 2025
ca5c636
Update styles.ts
raunofreiberg Jan 30, 2025
0ba2599
Update dialog.tsx
raunofreiberg Jan 30, 2025
213f534
Update error-feedback.tsx
raunofreiberg Jan 30, 2025
8765470
Fix test
raunofreiberg Jan 30, 2025
624d28c
oops
raunofreiberg Jan 30, 2025
f98dc71
test
raunofreiberg Jan 30, 2025
0ad9f46
call stack animate
raunofreiberg Jan 30, 2025
e2ef6db
Fix Safari
raunofreiberg Jan 31, 2025
9ec2d75
Unify terminal and code frame styles
raunofreiberg Jan 31, 2025
2515df7
Cleanup dialog
raunofreiberg Jan 31, 2025
f9fa928
Colored icons
raunofreiberg Jan 31, 2025
de420f0
Remove unnecessary icons
raunofreiberg Jan 31, 2025
2f8b959
Remove clipping
raunofreiberg Jan 31, 2025
704a222
Only return focus to trigger when focus was previously inside menu
raunofreiberg Jan 31, 2025
dd2302d
Revert icons to no color
raunofreiberg Jan 31, 2025
56b9950
add weight 500 geist mono
raunofreiberg Jan 31, 2025
6b648a1
Rewrite to use `dialogResizerRef` instead of relying on DOM
raunofreiberg Jan 31, 2025
b98d0d1
Address feedback
raunofreiberg Jan 31, 2025
80c44bc
Use single loop for ignored/visible frames
raunofreiberg Jan 31, 2025
529cc4a
Hide ignored frames from tab navigation when closed
raunofreiberg Jan 31, 2025
0f5e2e2
Comment useDelayedRender
raunofreiberg Jan 31, 2025
00c175a
Fix TS
raunofreiberg Jan 31, 2025
5b67f1c
Only blur call stack frame, no opacity
raunofreiberg Jan 31, 2025
ab43a27
Remove context
raunofreiberg Jan 31, 2025
8856412
Throw min height on call stack header
raunofreiberg Jan 31, 2025
cc761f0
overlay wip
raunofreiberg Jan 28, 2025
bbc440b
wip
raunofreiberg Jan 29, 2025
97296a4
many fixes
raunofreiberg Jan 30, 2025
796ae36
fix animation height
raunofreiberg Jan 30, 2025
ec3c549
cleanup
raunofreiberg Jan 30, 2025
d6fe965
align turbo border
raunofreiberg Jan 30, 2025
0925352
Update call-stack-frame.tsx
raunofreiberg Jan 30, 2025
7790140
Remove svg
raunofreiberg Jan 30, 2025
8e500d8
add app img
raunofreiberg Jan 30, 2025
126baf7
Update next-logo.tsx
raunofreiberg Jan 30, 2025
bbb91c2
add animation
raunofreiberg Jan 30, 2025
063906b
fix Escape
raunofreiberg Jan 30, 2025
bf39a67
Update styles.ts
raunofreiberg Jan 30, 2025
e669a9f
Update dialog.tsx
raunofreiberg Jan 30, 2025
c25dc23
Update error-feedback.tsx
raunofreiberg Jan 30, 2025
76f39c9
Fix test
raunofreiberg Jan 30, 2025
1c546d6
oops
raunofreiberg Jan 30, 2025
ea3318d
test
raunofreiberg Jan 30, 2025
95a19ab
call stack animate
raunofreiberg Jan 30, 2025
7af4b1f
Fix Safari
raunofreiberg Jan 31, 2025
aee3347
Unify terminal and code frame styles
raunofreiberg Jan 31, 2025
9e182bd
Cleanup dialog
raunofreiberg Jan 31, 2025
724a048
Colored icons
raunofreiberg Jan 31, 2025
dc9ae91
Remove unnecessary icons
raunofreiberg Jan 31, 2025
a64298c
Remove clipping
raunofreiberg Jan 31, 2025
33e70ed
Only return focus to trigger when focus was previously inside menu
raunofreiberg Jan 31, 2025
00d4f27
Revert icons to no color
raunofreiberg Jan 31, 2025
d36a29b
add weight 500 geist mono
raunofreiberg Jan 31, 2025
351584e
Rewrite to use `dialogResizerRef` instead of relying on DOM
raunofreiberg Jan 31, 2025
9db411a
Address feedback
raunofreiberg Jan 31, 2025
ba9fb82
Use single loop for ignored/visible frames
raunofreiberg Jan 31, 2025
96e1384
Hide ignored frames from tab navigation when closed
raunofreiberg Jan 31, 2025
e9a9e5f
Comment useDelayedRender
raunofreiberg Jan 31, 2025
cc170ce
Fix TS
raunofreiberg Jan 31, 2025
0e4e7ff
Only blur call stack frame, no opacity
raunofreiberg Jan 31, 2025
ea8d2a4
Remove context
raunofreiberg Jan 31, 2025
be9a8da
Throw min height on call stack header
raunofreiberg Jan 31, 2025
72ba501
fix: type for ErrorOverlayLayout test
devjiwonchoi Jan 31, 2025
df333ae
Update packages/next/src/client/components/react-dev-overlay/_experim…
raunofreiberg Feb 3, 2025
085f210
Merge branch 'rf/errors-overlay-polish' of github.com:vercel/next.js …
raunofreiberg Feb 4, 2025
4127f20
Merge branch 'canary' of github.com:vercel/next.js into rf/errors-ove…
raunofreiberg Feb 4, 2025
ef4d179
remove console log
raunofreiberg Feb 4, 2025
0bd71a1
Fix broken test
raunofreiberg Feb 4, 2025
ab89945
Update owner-stack-react-missing-key-prop.test.ts
raunofreiberg Feb 4, 2025
04935cb
Rewrite `useDelayedRender`
raunofreiberg Feb 4, 2025
8f833ec
Fix scroll
raunofreiberg Feb 4, 2025
8ef8342
keep filtered frames out of the DOM
ztanner Feb 5, 2025
750e0ab
keep CodeFrame tags the same to prevent snapshot changes on newline
ztanner Feb 5, 2025
92d3284
Merge branch 'canary' into rf/errors-overlay-polish
ztanner Feb 5, 2025
c56670a
snapshot updates
ztanner Feb 5, 2025
deddd9a
fix double border
ztanner Feb 5, 2025
e83e8e3
ensure full content can be scrolled
ztanner Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const preview: Preview = {
},
backgrounds: {
values: [
{ name: 'backdrop', value: 'rgb(44, 44, 46);' },
{ name: 'backdrop', value: 'rgba(250, 250, 250, 0.80)' },
{ name: 'background-100-light', value: '#ffffff' },
{ name: 'background-200-light', value: '#fafafa' },
{ name: 'background-100-dark', value: '#0a0a0a' },
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import type { OverlayState } from '../../shared'
import ReactDevOverlay from './react-dev-overlay'
import { ACTION_UNHANDLED_ERROR } from '../../shared'

// @ts-expect-error
import imgApp from './app.png'

const meta: Meta<typeof ReactDevOverlay> = {
component: ReactDevOverlay,
parameters: {
Expand Down Expand Up @@ -80,6 +83,17 @@ const state: OverlayState = {
export const Default: Story = {
args: {
state,
children: <div>Application Content</div>,
children: (
<div>
<img
src={imgApp}
style={{
width: '100%',
height: '100%',
objectFit: 'contain',
}}
/>
</div>
),
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { noop as css } from '../../helpers/noop-template'

export const CallStackFrame: React.FC<{
frame: OriginalStackFrame
}> = function CallStackFrame({ frame }) {
index: number
}> = function CallStackFrame({ frame, index }) {
// TODO: ability to expand resolved frames
// TODO: render error or external indicator

Expand All @@ -32,19 +33,32 @@ export const CallStackFrame: React.FC<{
// Formatted file source could be empty. e.g. <anonymous> will be formatted to empty string,
// we'll skip rendering the frame in this case.
const fileSource = getFrameSource(f)

if (!fileSource) {
return null
}

const props = {
...(hasSource && {
role: 'button',
tabIndex: 0,
'aria-label': 'Click to open in your editor',
title: 'Click to open in your editor',
onClick: open,
}),
}

return (
<div
data-nextjs-call-stack-frame
data-nextjs-call-stack-frame-ignored={!hasSource}
onClick={hasSource ? open : undefined}
role="button"
tabIndex={0}
aria-label={hasSource ? 'Click to open in your editor' : undefined}
title={hasSource ? 'Click to open in your editor' : undefined}
data-animate={frame.ignored}
{...props}
style={
{
'--index': index,
} as React.CSSProperties
}
>
<span
data-nextjs-frame-expanded={!frame.ignored}
Expand Down Expand Up @@ -86,18 +100,25 @@ export const CALL_STACK_FRAME_STYLES = css`
margin-bottom: var(--size-1);

border-radius: var(--rounded-lg);
transition: background 100ms ease-out;

&[data-animate='true'] {
filter: blur(4px);
animation: fadeIn 250ms var(--timing-swift) forwards
calc(var(--index) * 25ms);
}

&:not(:disabled):hover {
&:not(:disabled)[role='button']:hover {
background: var(--color-gray-alpha-100);
cursor: pointer;
}

&:not(:disabled):active {
&:not(:disabled)[role='button']:active {
background: var(--color-gray-alpha-200);
}

&:focus {
outline: none;
&:focus-visible {
outline: var(--focus-ring);
}
}

Expand All @@ -107,6 +128,7 @@ export const CALL_STACK_FRAME_STYLES = css`
gap: var(--size-1);

margin-bottom: var(--size-1);
font-family: var(--font-stack-monospace);

color: var(--color-gray-1000);
font-size: var(--size-font-small);
Expand All @@ -119,4 +141,10 @@ export const CALL_STACK_FRAME_STYLES = css`
font-size: var(--size-font-small);
line-height: var(--size-5);
}

@keyframes fadeIn {
to {
filter: blur(0px);
}
}
`
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,26 @@ export function CodeFrame({ stackFrame, codeFrame }: CodeFrameProps) {
column: stackFrame.column,
})

const fileExtension = stackFrame?.file?.split('.').pop()

// TODO: make the caret absolute
return (
<div data-nextjs-codeframe>
<div className="code-frame-header">
<p
role="link"
onClick={open}
tabIndex={1}
title="Click to open in your editor"
>
<span>
<FileIcon />
<button
aria-label="Open error location in editor"
className="code-frame-header"
onClick={open}
>
<p className="code-frame-link">
<span className="code-frame-icon">
<FileIcon lang={fileExtension} />
{getFrameSource(stackFrame)} @{' '}
<HotlinkedText text={stackFrame.methodName} />
</span>
<ExternalIcon width={16} height={16} />
</p>
</div>
<pre>
</button>
<pre className="code-frame-pre">
{decoded.map((entry, index) => (
<span
key={`frame-${index}`}
Expand All @@ -99,11 +100,6 @@ export function CodeFrame({ stackFrame, codeFrame }: CodeFrameProps) {

export const CODE_FRAME_STYLES = css`
[data-nextjs-codeframe] {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
flex: 1 0 0;

background-color: var(--color-background-200);
overflow: hidden;
color: var(--color-gray-1000);
Expand All @@ -116,12 +112,35 @@ export const CODE_FRAME_STYLES = css`
border-radius: var(--size-2);
}

[data-nextjs-codeframe] pre {
.code-frame-link,
.code-frame-pre {
padding: 12px;
}

.code-frame-pre {
white-space: pre-wrap;
}

.code-frame-header {
width: 100%;
cursor: pointer;
border-bottom: 1px solid var(--color-gray-400);
transition: background 100ms ease-out;

&:focus-visible {
outline: var(--focus-ring);
outline-offset: -2px;
}

&:hover {
background: var(--color-gray-100);
}
}

.code-frame-icon {
display: flex;
align-items: center;
gap: 6px;
}

[data-nextjs-codeframe]::selection,
Expand All @@ -137,27 +156,22 @@ export const CODE_FRAME_STYLES = css`

[data-nextjs-codeframe] > * {
margin: 0;
padding: calc(var(--size-gap) + var(--size-gap-half))
calc(var(--size-gap-double) + var(--size-gap-half));
}

[data-nextjs-codeframe] > div > p {
.code-frame-link {
display: flex;
align-items: center;
justify-content: space-between;
cursor: pointer;
margin: 0;
outline: 0;
}
[data-nextjs-codeframe] > div > p:hover {
text-decoration: underline dotted;
}

[data-nextjs-codeframe] div > pre {
overflow: hidden;
display: inline-block;
}

[data-nextjs-codeframe] svg {
color: var(--color-gray-900);
margin-right: 6px;
}
`
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,6 @@ export const COPY_BUTTON_STYLES = css`
.nextjs-data-runtime-error-copy-button--initial:hover {
cursor: pointer;
}
.nextjs-data-runtime-error-copy-button[aria-disabled='true'] {
opacity: 0.3;
cursor: not-allowed;
}
.nextjs-data-runtime-error-copy-button--error,
.nextjs-data-runtime-error-copy-button--error:hover {
color: var(--color-ansi-red);
Expand Down
Loading
Loading