Prerender HTTP access fallbacks with Cache Components semantics

The body of `if (cacheComponents)` in `prerenderToStream` is extracted
into a local helper, `prerenderWithCacheComponents`. The catch-block
error paths route through it whenever Cache Components is enabled, so
`not-found.tsx` / `forbidden.tsx` / `unauthorized.tsx` recovery now
renders the matching fallback boundary under Cache Components prerender
semantics. Dynamic API access in those boundaries — for example
`useSearchParams()` without a surrounding `<Suspense>` — surfaces as a
blocking-route error instead of the legacy `BailoutToCSRError`.

The segment-scoped recovery is wrapped in a `try` / `catch` that falls
through to the generic synthetic-shell recovery on a nested
`HTTPAccessFallbackError`, preserving the safety-net behavior from
 #94037 so the build still emits prerender artifacts when the matched
boundary's subtree itself re-throws `notFound()`.

Reapply of #93988 (reverted in #94018).
parent 80495b17
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment