Commit graph

1 commit

Author SHA1 Message Date
Jiachi Liu
594f3d1fc0
Fix root not-found page tree loader structure (#54080)
### 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
2023-08-16 15:10:08 +00:00