next.js
f7dd09fd - [Instant] Validation on client navs (#89777)

Commit
44 days ago
[Instant] Validation on client navs (#89777) This PR makes instant validation work for client navigations, albeit in a pretty inefficent way. If we're navigating and have an `instant` config somewhere in the tree, we won't skip shared layouts like a client navigation usually would. Instead, we render all the shared segments too (via `createFullTreeFlightDataForNavigation`, a very simplified variation of `walkTreeWithFlightRouterState`) and use them to perform instant validation on the current page. The client router doesn't mind getting extra segments -- `startPPRNavigation` (and `updateCacheNodeOnNavigation` specifically) ignore segments that are already present in the old tree. This approach has some downsides: - It doesn't match prod behavior (parent layouts don't render there), so it could lead to user confusion - We're validating using different segments that the browser actually has, so we could see an error in the validation that isn't present in the browser but we'll iterate on this later. We only do this when a page is using `instant`, so for now the impact is narrowed down to early adopters. ### Test changes For each test case we have, we now run it both on initial load and on client nav. This got somewhat noisy because i had to reorganize the test files a bit. We use the index pages to test client navigations, but in order to do that, we need the source and the target to be inside the same root layout -- otherwise, they'd be an MPA nav.
Author
Parents
Loading