mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #489] [MERGED] fix: make useParams() reactive on client-side navigation #612
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#612
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/489
Author: @NathanDrake2406
Created: 3/12/2026
Status: ✅ Merged
Merged: 3/12/2026
Merged by: @james-elicx
Base:
main← Head:fix/use-params-reactivity📝 Commits (3)
88e58f6fix: make useParams() reactive on client-side navigationcfcc34achore: fix formatting in test fixture8d55ec5fix: stabilize useParams server snapshot and deduplicate subscribe📊 Changes
3 files changed (+107 additions, -15 deletions)
View changed files
📝
packages/vinext/src/shims/navigation.ts(+27 -15)📝
tests/e2e/app-router/nextjs-compat/hooks.spec.ts(+57 -0)➕
tests/fixtures/app-basic/app/nextjs-compat/hooks-params-nav/[id]/page.tsx(+23 -0)📄 Description
Summary
useParams()was reading a module-level variable directly instead of subscribing viauseSyncExternalStore, so navigating between dynamic routes (e.g./posts/1→/posts/2) wouldn't re-render components usinguseParams()useParams()now usesuseSyncExternalStorewith the shared listener system, matchingusePathname()anduseSearchParams()setClientParams()now callsnotifyListeners()when params actually change, so the external store re-checks snapshotsTest plan
useParamsupdates reactively on client-side Link navigation (/1→/2)useParamsupdates across multiple consecutive navigations (/1→/2→/3→/1)useParamsupdates on browser back/forward history navigation🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.