mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1028] [MERGED] fix(navigation): hard-nav to target when render error tears down the tree #1031
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#1031
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/1028
Author: @james-elicx
Created: 5/2/2026
Status: ✅ Merged
Merged: 5/2/2026
Merged by: @james-elicx
Base:
main← Head:fix/navigation-rsc-error-recovery📝 Commits (1)
d07a965fix(navigation): hard-nav to target when render error tears down the tree📊 Changes
3 files changed (+126 additions, -3 deletions)
View changed files
📝
packages/vinext/src/server/app-browser-entry.ts(+21 -2)📝
packages/vinext/src/server/app-browser-error.ts(+23 -0)📝
tests/app-browser-entry.test.ts(+82 -1)📄 Description
Summary
createPendingNavigationCommitonly awaits the top-level elements promise — it doesn't see the rejected nested reference, so the dispatch goes through.use()unwraps the rejected reference, and without anerror.tsxboundary aboveNavigationCommitSignalthe entire root unmounts.NavigationCommitSignal's pre-paint layout effect, which never runs when the commit fails. Result: stale URL, blank page, console-only error.Fix
pendingNavigationRecoveryHref. Set it just beforedispatchBrowserTree; clear it once the commit effect updates history (and on the synchronous catch path).onUncaughtErrorhandler tohydrateRootthat reads the recovery href at fire time andwindow.location.assign()s to it. The user lands on the URL they clicked and the server can render its actual error UI for that route.onCaughtErrorwas registered, dev-only).Tests
tests/app-browser-entry.test.tscover: hard-nav on pending recovery href, no-op when nothing is pending (initial hydration error), error + component stack always logged, lazy read so newer navigations win.Test plan
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.