Keep cached root parameters out of generic fallback shells (#98950)
## Summary Replace #98892 with a fix for both ways root-dependent content can enter a generic fallback shell: reusing an existing Resume Data Cache entry and executing a fresh cache fill. For example, cached English content produced for `/en/items/one` remains reusable in `/en/items/[slug]`, but must be absent from `/[lang]/items/[slug]`. When reusing that concrete prerender as a seed, clone its cache map and replace entries whose recorded `readRootParamNames` intersect the unknown roots with omission markers. The original seed is unchanged. Keep those markers in the cache map itself, not a separate collection that must stay synchronized. They carry the reason for a hole between prerender passes and are never serialized into the persisted RDC. Preserve canary's distinction between URL data and session data when computing shell and prefetch hints. For fresh fills, an unknown root read suspends the entire cache invocation, including cached components with an internal Suspense boundary. Affected nested caches use independently cancellable prerenders. Dependencies propagate through consumers without cancelling independent sibling fills or saving aborted partial results. A top-level caller joining a nested cache fill must also record the omission marker: the nested leader has no RDC of its own. Otherwise the final prerender sees an unexplained miss and loses the fallback's prefetch hint. This applies to intra-request joins as well as cross-request joins. This is prerequisite work for configurable root fallbacks in #97393. Without the new API, ordinary misses for root parameters still block. The prerequisite fixture inspects ordinary build artifacts and document requests; the API fixtures exercise fresh fills through real fallback requests and tag invalidation. Neither uses forced rendering or shell-debugging hooks. ## Verification - Prerequisite root-cache fixture: five production tests pass with both Webpack and freshly built Turbopack. - API root-cache isolation and root-parameter fixtures: eleven production tests pass with each bundler. Fourteen closed-route revalidation tests also pass with Webpack after restacking. - The new nested-leader/top-level-join regression fails without the marker write with the reported unexpected-cache-miss warning, and passes with the write. Data-service barriers determine the ordering; no timing sleeps or framework test hooks are used. - Existing runtime prerender cache-warming coverage: eight Webpack tests pass, including cached pages that await params/searchParams. - The three focused unit suites pass together: 114 tests on this prerequisite and 128 on the API layer, with four snapshots each. The postponed-state assertion no longer snapshots Node's incidental async-hooks fields on promises. - Full workspace/native builds and package/repository type checks pass. - Deployment tests were not run locally for this update. <!-- NEXT_JS_LLM -->
Showing
This diff is collapsed.
Please
register
or
sign in
to comment