mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #930] [MERGED] fix(app-router): keep ownerless URL commits from releasing navigation snapshots #957
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#957
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/930
Author: @NathanDrake2406
Created: 4/28/2026
Status: ✅ Merged
Merged: 4/28/2026
Merged by: @james-elicx
Base:
main← Head:nathan/fix-snapshot-ownership📝 Commits (1)
8684250fix(app-router): keep ownerless URL commits from releasing snapshots📊 Changes
3 files changed (+104 additions, -10 deletions)
View changed files
📝
packages/vinext/src/server/app-browser-entry.ts(+2 -2)📝
packages/vinext/src/shims/navigation.ts(+16 -8)📝
tests/shims.test.ts(+86 -0)📄 Description
What changed
Ownerless client URL sync commits no longer release an active App Router navigation render snapshot.
Why
commitClientNavigationState(undefined)covered both ownerless URL syncs and superseded-transition cleanup. Hash-only navigation and patchedhistory.pushState/history.replaceStatecould therefore consume a snapshot owned by an in-flight navigation. Once consumed,usePathname()anduseSearchParams()stopped reading the pending render snapshot and could flicker back to stale committed URL state mid-transition.Approach
commitClientNavigationStatenow releases a snapshot only when called by a navigation owner (navId) or when a superseded App Router cleanup path explicitly opts into snapshot release. Ownerless URL sync paths still update committed pathname/search state and notify subscribers, but they do not balanceactivateNavigationSnapshot().The App Router superseded cleanup sites pass
{ releaseSnapshot: true }while keepingnavIdundefined so they continue to avoid clearingpendingPathnameowned by a newer navigation.Validation
vp test run tests/shims.test.ts -t "keeps pending render snapshot active"vp test run tests/app-browser-entry.test.tsvp test run tests/shims.test.tsvp checkRisks / follow-ups
The main risk is future superseded-transition cleanup code forgetting to opt into
releaseSnapshot. The current App Router cleanup paths are explicit, and ownerless URL sync remains intentionally non-releasing.Next.js references
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.