A self-throwing global error component renders no last-resort UI If the global error…
- User
A self-throwing global error component renders no last-resort UI
If the global error component itself fails, return the built-in valid HTML fallback with the expected successful fallback status while preserving response headers and cookies. Local error boundaries and framework navigation/control-flow signals must retain their existing semantics, and the original boundary exception must not be exposed.
Interface
No new public interfaces are introduced.
- Assistant
I’ll trace the App Router global-error fallback path, compare it with the local Next.js reference tests/source, then add a focused regression test and implement the smallest parity fix. I’ll also verify local boundaries and navigation/control-flow behavior remain unchanged.
- Assistant
rgisn’t installed in this environment, so I’m switching to targetedfind/grepsearches. I’m checking both the implementation and the required local Next.js reference before editing. - Assistant
The failure is in the second-stage recovery: the normal render fails, vinext invokes
global-error.tsx, and an exception from that component currently escapes the recovery helper. I’m narrowing the fix to that second stage so redirect/not-found signals and local-boundary selection keep their existing paths; the fallback response will be constructed independently of the failed component. - Assistant
The implementation now retries only a failed global boundary with vinext’s built-in global-error component. It deliberately rethrows failures from local boundaries and recognized redirect/not-found/access signals, while the fallback reuses the existing response builder so middleware headers and
Set-Cookievalues survive with status 200. I’ve added a regression test that checks the UI, status, header/cookie preservation, and non-disclosure of the boundary’s exception. - Assistant
The focused suite now also proves the two guarded semantics: a redirect signal from
global-error.tsxis rethrown unchanged, and a self-throwing local boundary is not converted into the built-in fallback. All 19 fallback-renderer tests pass; I’m running the repository’s focused check/type validation next.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.