fffa4c3d9b
### What When a global not found page is rendered, and when the not-found page or containing layout has a link with `prefetch: auto` back to the root page, the router would update the URL but not correctly swap out the not-found component with the page component. ### Why With auto prefetching (which is the default when `prefetch` is left unspecified on a link), the router will perform a partial prefetch on dynamic pages. This means it'll fetch the flight data _without_ React nodes and store it in the prefetch cache. On navigation, this is used to determine where we already have cached React nodes and where we need to trigger a lazy fetch to get new data. However, global not found pages are peculiar in that they will always contain a data path like: `['', { children: ['__PAGE__', {}] }]` since they are inserted at the root. This means that if there's also a page component that corresponds with the same path, the router will incorrectly think it already has cache node data for it. ### How During SSR when the `asNotFound` flag signals to the renderer that the component we're rendering is matching the global not-found page, we modify the segment key to be something unique so the data path won't collide with a top-level page. In [fc01c8e]( |
||
---|---|---|
.. | ||
app | ||
prefetching-not-found.test.ts |