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
752d6e49
Unverified
Commit
752d6e49
authored
Mar 25, 2024
by
Balázs Orbán
Committed by
GitHub
Mar 25, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(error-overlay): style tweaks (#63522)
parent
043bbaa7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
16 deletions
+17
-16
Errors.tsx
...omponents/react-dev-overlay/internal/container/Errors.tsx
+7
-8
hydration-error.test.ts
test/development/acceptance-app/hydration-error.test.ts
+3
-8
next-test-utils.ts
test/lib/next-test-utils.ts
+7
-0
No files found.
packages/next/src/client/components/react-dev-overlay/internal/container/Errors.tsx
View file @
752d6e49
...
...
@@ -255,8 +255,8 @@ export function Errors({
<
span
>
{
activeIdx
+
1
}
</
span
>
of
{
' '
}
<
span
data
-
nextjs
-
dialog
-
header
-
total
-
count
>
{
readyErrors
.
length
}
</
span
>
{
' '
}
unhandled error
</
span
>
{
' error'
}
{
readyErrors
.
length
<
2
?
''
:
's'
}
</
small
>
{
versionInfo
?
<
VersionStalenessInfo
{
...
versionInfo
}
/>
:
null
}
...
...
@@ -316,10 +316,10 @@ export const styles = css`
margin-left: var(--size-gap-double);
}
.nextjs-container-errors-header small > span {
font-family:
var(--font-stack-monospace)
;
font-family:
sans-serif
;
}
.nextjs-container-errors-header p {
font-family:
var(--font-stack-monospace)
;
font-family:
sans-serif
;
font-size: var(--size-font-small);
line-height: var(--size-font-big);
font-weight: bold;
...
...
@@ -328,14 +328,13 @@ export const styles = css`
white-space: pre-wrap;
}
.nextjs__container_errors_desc--error {
color: var(--color-ansi-red);
padding-left: var(--size-gap);
border-left: 4px solid var(--color-accents-1);
color: var(--color-font);
}
.nextjs__container_errors__extra {
margin: 20px 0;
}
nextjs__container_errors__extra__code {
margin: 10px 0;
}
.nextjs-container-errors-header > div > small {
margin: 0;
margin-top: var(--size-gap-half);
...
...
test/development/acceptance-app/hydration-error.test.ts
View file @
752d6e49
...
...
@@ -3,6 +3,7 @@ import { sandbox } from 'development-sandbox'
import
{
FileRef
,
nextTestSetup
}
from
'e2e-utils'
import
path
from
'path'
import
{
outdent
}
from
'outdent'
import
{
getRedboxTotalErrorCount
}
from
'next-test-utils'
// https://github.com/facebook/react/blob/main/packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js used as a reference
...
...
@@ -373,10 +374,7 @@ describe('Error overlay for hydration errors', () => {
await
session
.
waitForAndOpenRuntimeError
()
expect
(
await
session
.
hasRedbox
()).
toBe
(
true
)
const
totalErrorCount
=
await
browser
.
elementByCss
(
'[data-nextjs-dialog-header-total-count]'
)
.
text
()
expect
(
totalErrorCount
).
toBe
(
'1'
)
expect
(
await
getRedboxTotalErrorCount
(
browser
)).
toBe
(
1
)
const
description
=
await
session
.
getRedboxDescription
()
expect
(
description
).
toContain
(
...
...
@@ -436,10 +434,7 @@ describe('Error overlay for hydration errors', () => {
await
session
.
waitForAndOpenRuntimeError
()
expect
(
await
session
.
hasRedbox
()).
toBe
(
true
)
const
totalErrorCount
=
await
browser
.
elementByCss
(
'[data-nextjs-dialog-header-total-count]'
)
.
text
()
expect
(
totalErrorCount
).
toBe
(
'1'
)
expect
(
await
getRedboxTotalErrorCount
(
browser
)).
toBe
(
1
)
const
description
=
await
session
.
getRedboxDescription
()
expect
(
description
).
toContain
(
...
...
test/lib/next-test-utils.ts
View file @
752d6e49
...
...
@@ -790,6 +790,13 @@ export async function getRedboxHeader(browser: BrowserInterface) {
)
}
export
async
function
getRedboxTotalErrorCount
(
browser
:
BrowserInterface
)
{
return
parseInt
(
(
await
getRedboxHeader
(
browser
)).
match
(
/
\d
+ of
(\d
+
)
error/
)?.[
1
],
10
)
}
export
async
function
getRedboxSource
(
browser
:
BrowserInterface
)
{
return
retry
(
()
=>
...
...
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