Cached Navigations: Serve cached segments instantly on repeat visits
When navigating to a dynamic (or partially static) page with Cache
Components, the server now uses staged rendering to separate the static
portion (backed by the Resume Data Cache) from the dynamic portion
(runtime APIs like `cookies`, `headers`, `connection`, or uncached I/O).
The static stage byte length is embedded in the RSC payload so the
client can extract it.
On the client, the first navigation clones the response stream,
truncates it to the static stage byte length, decodes it as a partial
Flight response, and writes the result into the segment cache.
Subsequent navigations find these cached segments and display them
instantly while fetching only the dynamic data from the server.
Server-side changes:
- Add `generateStagedDynamicFlightRenderResult` with
`StaleTimeIterable`, byte counting via tee'd stream, and
stage-separated rendering
- Enable `asyncApiPromises` checks in production for `cookies`,
`headers`, `connection`, `searchParams`, and `params`
- Propagate stale time to `RequestStore` for Cache Components
- Thread `fallbackParams` from prerender manifest to production renders
- Rename `devFallbackParams` → `fallbackParams` (now used in both
dev/prod)
Client-side changes:
- Clone response in `fetchServerResponse`, truncate to static byte
length, decode with `allowPartialStream`
- Write static stage into segment cache via
`writeStaticStageResponseIntoCache`
- Use `getFulfilledRouteVaryPath` in `writeRouteIntoCache` for
`Fallback` keying
- Refactor `writeDynamicRenderResponseIntoCache` (remove dead `task`
param, accept `headers` directly)
In a follow-up we'll also handle fully static pages.