When using generateStaticParams with interception routes, the interception would never occur, and instead an MPA navigation would take place to the targeted link.
Why
For interception rewrites, we use a __NEXT_EMPTY_PARAM__ marker (in place of the actual param slot, eg :locale) for any params that are discovered prior to the interception marker. This is because during route resolution, the params for the interception route might not contain the same params for the page that triggered the interception. The dynamic params are then extracted from FlightRouterState at render time. However, when generateStaticParams is present, the FlightRouterState header is stripped from the request, so it isn't able to extract the dynamic params and so the router thinks the new tree is a new root layout, hence the MPA navigation.
How
This removes the __NEXT_EMPTY_PARAM__ hack and several spots where we were forcing interception routes to be dynamic as a workaround to the above bug. Now when resolving the route, if the request was to an interception route, we extract the dynamic params from the request before constructing the final rewritten URL. This will ensure that the params from the "current" route are available in addition to the params from the interception route without needing to defer until render.
What
When using
generateStaticParams
with interception routes, the interception would never occur, and instead an MPA navigation would take place to the targeted link.Why
For interception rewrites, we use a
__NEXT_EMPTY_PARAM__
marker (in place of the actual param slot, eg:locale
) for any params that are discovered prior to the interception marker. This is because during route resolution, theparams
for the interception route might not contain the sameparams
for the page that triggered the interception. The dynamic params are then extracted fromFlightRouterState
at render time. However, whengenerateStaticParams
is present, theFlightRouterState
header is stripped from the request, so it isn't able to extract the dynamic params and so the router thinks the new tree is a new root layout, hence the MPA navigation.How
This removes the
__NEXT_EMPTY_PARAM__
hack and several spots where we were forcing interception routes to be dynamic as a workaround to the above bug. Now when resolving the route, if the request was to an interception route, we extract the dynamic params from the request before constructing the final rewritten URL. This will ensure that the params from the "current" route are available in addition to the params from the interception route without needing to defer until render.Fixes #65192 Fixes #52880