mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1000] [MERGED] fix(app-router): preserve falsy thrown values in error boundaries #1012
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#1012
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/1000
Author: @NathanDrake2406
Created: 5/1/2026
Status: ✅ Merged
Merged: 5/1/2026
Merged by: @james-elicx
Base:
main← Head:nathan/fix-falsy-error-boundary📝 Commits (1)
6a60dccfix(app-router): preserve falsy thrown values in error boundaries📊 Changes
6 files changed (+126 additions, -23 deletions)
View changed files
📝
packages/vinext/src/server/app-page-route-wiring.tsx(+2 -2)📝
packages/vinext/src/shims/error-boundary.tsx(+12 -8)📝
tests/e2e/app-router/error-handling.spec.ts(+24 -0)📝
tests/error-boundary.test.ts(+25 -13)➕
tests/fixtures/app-basic/app/falsy-error-boundary-test/error.tsx(+18 -0)➕
tests/fixtures/app-basic/app/falsy-error-boundary-test/page.tsx(+45 -0)📄 Description
What this changes
App Router error boundaries now preserve falsy thrown values such as
undefined,null,0,"", andfalseinstead of treating them as no captured error. Segment error boundary props now acceptunknown, matching the fact that JavaScript can throw non-Errorvalues.Fixes #989.
Why
Next.js fixed the same failure mode in vercel/next.js#93134 via ea541987d1735493c63b52d0b6e673d4435cbb20. The important invariant is that boundary state must distinguish “no error” from “an error was thrown with a falsy value”.
Relevant upstream source:
ErrorBoundaryHandlerStatewraps thrown valuesthrownValueunstable_catchErrorApproach
Error | nulltonull | { thrownValue: unknown }.unknown, not an incorrectly narrowedError.Validation
vp test run tests/error-boundary.test.tsvp check packages/vinext/src/shims/error-boundary.tsx packages/vinext/src/server/app-page-route-wiring.tsx tests/error-boundary.test.ts tests/e2e/app-router/error-handling.spec.ts tests/fixtures/app-basic/app/falsy-error-boundary-test/error.tsx tests/fixtures/app-basic/app/falsy-error-boundary-test/page.tsxvp run vinext#buildPLAYWRIGHT_PROJECT=app-router vp run test:e2e tests/e2e/app-router/error-handling.spec.tsRisks / follow-ups
This PR intentionally scopes the change to vinext's existing App Router error-boundary shim. The HTTP access fallback boundaries already track explicit boolean/status state, and redirects continue through the existing digest rethrow path.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.