Fix catch-all index page being served for every other slug (#96553)
Navigating between sibling pages of an optional catch-all could leave the URL updated but the content stuck on the route's index page, with no request made at all. On nextjs.org that is every /docs/* sidebar link, once /docs itself has been prefetched. The App Shell of a segment is the part that doesn't depend on params, so the cache keeps one copy and reuses it for every param value. The client decides it has that shell when a response arrives without a shell/full split. But a response arrives without a split whenever the render had no dynamic hole, and that is also what a page fully prerendered at concrete params looks like. The split alone can't tell the two apart, and the second is not param-independent at all — its content is the params. So the /docs page was stored as the shell for every slug. Because a payload that needs nothing further is also recorded complete, sibling slugs read it and stopped there: no prefetch, and no dynamic request during navigation to correct it. Treat a payload as param-independent only on evidence. The server already reports which params each segment depends on, so use that. Without it, assume every param varies, except for a shell variant, which reduces param-dependent content to param fallbacks and so is good for any value of them. The new e2e suite prefetches a fully static catch-all index, navigates there, then prefetches and navigates to a sibling slug. It fails on canary with a prefetch that never fires, and is verified with vary params both enabled and disabled.
Showing
Please
register
or
sign in
to comment