mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #463] [MERGED] fix: return route pattern from router.pathname, not resolved path #589
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#589
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/463
Author: @NathanDrake2406
Created: 3/11/2026
Status: ✅ Merged
Merged: 3/11/2026
Merged by: @james-elicx
Base:
main← Head:fix/router-url-as-two-value📝 Commits (8)
715fd44fix: stabilize instrumentation state and hydration E2E testsce20051fix: honor theasparameter in router.push/replace3da95b4fix: address PR review feedbackfad6f97fix: remove pathname assertion that tests unimplemented behavior090b76cfix: return route pattern from router.pathname, not resolved path509e340fix: set SSR pathname to route pattern to prevent hydration mismatcha5bb971Merge remote-tracking branch 'origin/main' into fix/router-url-as-two-valueeeb5fdctest: update entry-templates snapshots for pathname fix📊 Changes
8 files changed (+16 additions, -12 deletions)
View changed files
📝
packages/vinext/src/build/static-export.ts(+2 -2)📝
packages/vinext/src/entries/pages-server-entry.ts(+1 -1)📝
packages/vinext/src/server/dev-server.ts(+1 -1)📝
packages/vinext/src/shims/router.ts(+7 -2)📝
tests/__snapshots__/entry-templates.test.ts.snap(+1 -1)📝
tests/e2e/pages-router/dynamic-routes.spec.ts(+2 -2)📝
tests/e2e/pages-router/navigation.spec.ts(+1 -2)📝
tests/pages-router.test.ts(+1 -1)📄 Description
Summary
router.pathnamenow returns the route pattern (e.g.,/posts/[id]) instead of the resolved path (/posts/42), matching Next.js semanticsrouter.asPathcontinues to return the resolved browser URL as expected__NEXT_DATA__.page(which holds the route pattern from SSR and is updated on every client navigation) as the source of truth forpathnameDepends on #453 — this branch includes those commits. Merge #453 first, then this PR.
Closes #462
Test plan
shims.test.ts)router.pathnameis/posts/[id]afteras-based navigationrouter.pathnameis/posts/[id]on SSR page load🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.