Files
Zack TannerandGitHub c06658e919 fix: preserve HTTP access fallbacks during prerender recovery (#92231)
When a `notFound()`, `forbidden()`, or `unauthorized()` error escapes
into the outer prerender recovery path, we were falling back to the
generic error shell flow.

In the `cacheComponents` case, that could leave us with:
- error HTML rendered from `ErrorApp`
- Flight data reused from the aborted prerender prelude
- references to Flight chunks that were never emitted

That is what caused the client-side `Connection closed` failure in
#86251.

Instead of rerendering the full Flight tree or always using the generic
error RSC payload, this change:

- finds the deepest matching HTTP fallback boundary
- rerenders the normal app router payload with that segment-scoped
fallback
- tees the replacement Flight stream so Fizz can render from one copy
while prerender buffering consumes the other
- only takes this path for recoverable HTTP access fallbacks that have a
real boundary (ie a defined not-found/unauthorized/etc)

If no matching boundary exists, we keep the existing generic error
handling.

Fixes #86251
Fixes #90837
Closes #87041
Closes #86251

Closes NAR-711
Closes NEXT-4876
2026-04-02 07:54:11 -07:00

18 lines
424 B
TypeScript

import { Suspense } from 'react'
async function AsyncComponent() {
await new Promise<void>((resolve) => setTimeout(resolve, 100))
return <div id="async-data">Async Data Loaded</div>
}
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<div>
{children}
<Suspense fallback={<div>Loading async...</div>}>
<AsyncComponent />
</Suspense>
</div>
)
}