Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ppr: ensure the router state tree is provided for interception routes (…
…vercel#61059) ### What? Interception routes on dynamic paths don't currently work when PPR is turned on, and instead trigger an MPA navigation to the full route. ### Why? Route interception relies on the `Next-Flight-Router-State` header to extract the dynamic params necessary to convert something like `[locale]`, which would correspond with a URL of `/en`, to something like `["locale", "en", "d"]`. (See [this function](https://github.com/vercel/next.js/blob/fbfd7b5f81397fc6500e3c3a25bfd6627e9abb8f/packages/next/src/server/app-render/app-render.tsx#L129-L137) for more info). When PPR is turned on, we currently ignore this request header and don't provide it to the functions that render the component tree. Without the flight router state, this function bails out and instead will leave the segment key as `[locale]`. When the client router goes to diff the current tree on the client with the response from the server, it will detect a mismatch between the current segment and the incoming segment, and trigger an MPA navigation in [this block](https://github.com/vercel/next.js/blob/fbfd7b5f81397fc6500e3c3a25bfd6627e9abb8f/packages/next/src/client/components/router-reducer/reducers/navigate-reducer.ts#L414-L416). ### How? This special-cases interception routes to not strip this header. Closes NEXT-2215
- Loading branch information