Files
Hendrik LiebauandGitHub 2ba73b7a30 Fix per-segment prefetching for initial loads with Cache Components (#90610)
The `S` field in the RSC payload was only set to `true` during static
generation, but the client used it to determine whether a route supports
per-segment prefetching (`isPPREnabled` on the route cache entry). For
partially static pages with Cache Components enabled, the initial HTML
is served via PPR resume, which generates the RSC payload at request
time with `isStaticGeneration` set to `false`. This caused `S` to be
`false` even though the route fully supports per-segment prefetching.

This caused the prefetch scheduler to fall back to the `LoadingBoundary`
fetch strategy instead of `PPR`, which skipped fetching
`_head.segment.rsc` and instead sent a `metadata-only` dynamic request.
That request returned a 404 locally (harmless) but a 200 with an empty
body on Vercel, which interfered with same-page navigation refreshes
introduced in #76223 and exposed by the route cache keying fix in
#90400.

To fix this, `S` is now also set to `true` when `cacheComponents` is
enabled, since all Cache Components routes support per-segment
prefetching. When Cache Components is disabled, `S` continues to rely
solely on `isStaticGeneration`, which is correct because fully static
pages always have both their RSC payload and per-segment prefetch
responses generated at build time.

This PR also renames `isPPREnabled` to `supportsPerSegmentPrefetching`
on the client and updates the `S` field comments in the RSC payload
types to better reflect the field's actual meaning.
2026-02-26 20:21:17 +00:00
..