mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What & Why
Previously when rendering the root `/_not-found` in production, we'll always override the parallel routes component children with not-found component, this will break the navigation in build mode from root 404 `/_not-found` path.
### How
The new solution is to change the root `/_not-found` rendering strategy. Previously the loader tree of `/_not-found` look like this
```js
['',
{
children: ['not-found', {}, {}]
},
{ layout: ..., 'not-found': ...}
]
```
it's not a pretty valid tree, which could lead to problems during rendering.
New solution is to change the children to render a page, but the page content is `not-found.js` component. The new tree of root not-found will look like
```js
['',
{
children: ['__PAGE__', {}, {
page: ... // same as root 'not-found'
}]
},
{ layout: ..., 'not-found': ...}
]
```
This change could fix the navigation on the root not-found page.
Fixes #52264
14 lines
245 B
TypeScript
14 lines
245 B
TypeScript
'use client'
|
|
import Link from 'next/link'
|
|
|
|
export default function ErrorComponent() {
|
|
return (
|
|
<>
|
|
<h1 id="error-component">Error Happened!</h1>
|
|
<Link href="/result" id="to-result">
|
|
To Result
|
|
</Link>
|
|
</>
|
|
)
|
|
}
|