mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #462] Track full url/as two-value navigation approach #105
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#105
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?
Originally created by @NathanDrake2406 on GitHub (Mar 11, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/462
Context
In Next.js,
router.push(url, as)keepsurlandasas separate values throughout the navigation lifecycle:urldetermines which page module to load and which data to fetchasis the cosmetic URL shown in the browser barhistory.statefor back/forward restorationvinext currently collapses them into a single value in
resolveNavigationTarget()— whenasis provided,urlis discarded entirely. The result is used for bothhistory.pushStateandnavigateClient().What's been fixed
router.pathnamenow correctly returns the route pattern (/posts/[id]) instead of the resolved path (/posts/42) — fixed in #463asparameter support inrouter.push/replace— fixed in #453What remains
Purely decorative
asvalues that don't map to a real server route would causenavigateClient()to fetch the wrong page or 404. On popstate (back/forward), we only have theasvalue from the URL bar — Next.js retrieves the storedurlfromhistory.statefor data fetching.To fully match Next.js, we'd need to:
urlandasinhistory.stateurlfor data fetching instead ofwindow.location.pathnameWhen to implement
This was largely replaced by
rewritesafter Next.js 9.5.3, so the purely-decorative pattern is rare. Implement if someone reports a real-world use case that breaks.Ref: PR #453 review discussion.