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
278 B
TypeScript
14 lines
278 B
TypeScript
import { createNextDescribe } from 'e2e-utils'
|
|
import { runTest } from './index.test'
|
|
|
|
createNextDescribe(
|
|
'app dir - not found navigation - with overridden node env',
|
|
{
|
|
files: __dirname,
|
|
env: { NODE_ENV: 'test' },
|
|
},
|
|
({ next }) => {
|
|
runTest({ next })
|
|
}
|
|
)
|