[PPF] Use RDC in cachedNavigations codepaths (#98005)
Closes NAR-954 In Partial Prefetching, the embedded runtime stream codepath awas accidentally dropping the RDC. This PR fixes this by prefilling the mutable cache from the RDC. we ungate the failing tests introduced in #99417 and add some more e2e ones. As a drive-by improvement, i've also moved the `cacheReady()` call to happen after the main render runs through all the stages. It's pretty strange to call `cacheReady()` before we've even started the render that might fill any caches. I'm guessing it works because the code in-between runs quickly enough, but it's still a potential race and we shouldn't do it. ### How this bug got introduced In #94194 we accidentally started clobbering the resume data cache in the `cachedNavigations` codepath (i.e. when rendering the embedded runtime prefetch stream). This assignment used to be non-destructive because `prerenderResumeDataCache` was separate: https://github.com/vercel/next.js/blob/b0420899b68a4f7506fdbc93ff5acf6edcfa3d3c/packages/next/src/server/app-render/app-render.tsx#L969-L972 But after unifying `prerenderResumeDataCache` and `renderResumeDataCache`, we started essentially dropping the RDC and using an empty one https://github.com/vercel/next.js/blob/8c661813a1e66cd85b795e3aeae0f04ae3e3201e/packages/next/src/server/app-render/app-render.tsx#L970-L973 This wasn't caught because the tests that checked RDC behavior weren't exercising this codepath (at the time: no `cachedNavigations` + runtime prefetch opt in, and later on no `partialPrefetching` opt in)
Showing
Please
register
or
sign in
to comment