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
ddc8807a
Unverified
Commit
ddc8807a
authored
Oct 24, 2024
by
Jiachi Liu
Committed by
GitHub
Oct 24, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fully enable custom error callbacks for app router (#71794)
parent
af6f6aa9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
app-index.tsx
packages/next/src/client/app-index.tsx
+13
-16
No files found.
packages/next/src/client/app-index.tsx
View file @
ddc8807a
...
@@ -217,6 +217,12 @@ function Root({ children }: React.PropsWithChildren<{}>) {
...
@@ -217,6 +217,12 @@ function Root({ children }: React.PropsWithChildren<{}>) {
return
children
return
children
}
}
const
reactRootOptions
=
{
onRecoverableError
,
onCaughtError
,
onUncaughtError
,
}
satisfies
ReactDOMClient
.
RootOptions
export
function
hydrate
()
{
export
function
hydrate
()
{
const
reactEl
=
(
const
reactEl
=
(
<
StrictModeIfEnabled
>
<
StrictModeIfEnabled
>
...
@@ -231,19 +237,6 @@ export function hydrate() {
...
@@ -231,19 +237,6 @@ export function hydrate() {
const
rootLayoutMissingTags
=
window
.
__next_root_layout_missing_tags
const
rootLayoutMissingTags
=
window
.
__next_root_layout_missing_tags
const
hasMissingTags
=
!!
rootLayoutMissingTags
?.
length
const
hasMissingTags
=
!!
rootLayoutMissingTags
?.
length
const
errorCallbacks
=
typeof
(
React
as
any
).
captureOwnerStack
===
'function'
&&
process
.
env
.
NODE_ENV
!==
'production'
?
{
onCaughtError
,
onUncaughtError
,
}
:
undefined
const
options
=
{
onRecoverableError
,
...
errorCallbacks
,
}
satisfies
ReactDOMClient
.
RootOptions
const
isError
=
const
isError
=
document
.
documentElement
.
id
===
'__next_error__'
||
hasMissingTags
document
.
documentElement
.
id
===
'__next_error__'
||
hasMissingTags
...
@@ -252,14 +245,18 @@ export function hydrate() {
...
@@ -252,14 +245,18 @@ export function hydrate() {
const
createDevOverlayElement
=
const
createDevOverlayElement
=
require
(
'./components/react-dev-overlay/client-entry'
).
createDevOverlayElement
require
(
'./components/react-dev-overlay/client-entry'
).
createDevOverlayElement
const
errorTree
=
createDevOverlayElement
(
reactEl
)
const
errorTree
=
createDevOverlayElement
(
reactEl
)
ReactDOMClient
.
createRoot
(
appElement
as
any
,
options
).
render
(
errorTree
)
ReactDOMClient
.
createRoot
(
appElement
as
any
,
reactRootOptions
).
render
(
errorTree
)
}
else
{
}
else
{
ReactDOMClient
.
createRoot
(
appElement
as
any
,
options
).
render
(
reactEl
)
ReactDOMClient
.
createRoot
(
appElement
as
any
,
reactRootOptions
).
render
(
reactEl
)
}
}
}
else
{
}
else
{
React
.
startTransition
(()
=>
React
.
startTransition
(()
=>
(
ReactDOMClient
as
any
).
hydrateRoot
(
appElement
,
reactEl
,
{
(
ReactDOMClient
as
any
).
hydrateRoot
(
appElement
,
reactEl
,
{
...
o
ptions
,
...
reactRootO
ptions
,
formState
:
initialFormStateData
,
formState
:
initialFormStateData
,
})
})
)
)
...
...
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