Files
Nathan Nguyen 9bd7f811e0 fix: make useParams() reactive on client-side navigation (#489)
* fix: make useParams() reactive on client-side navigation

useParams() was reading a module-level variable directly instead of
subscribing via useSyncExternalStore, so navigating between dynamic
routes (e.g. /posts/1 → /posts/2) wouldn't re-render components.

Two changes:
- useParams() now uses useSyncExternalStore with the shared listener
  system, matching usePathname() and useSearchParams()
- setClientParams() now calls notifyListeners() when params change,
  so the external store knows to re-check snapshots

* chore: fix formatting in test fixture

* fix: stabilize useParams server snapshot and deduplicate subscribe

- Add _EMPTY_PARAMS constant to avoid creating a new {} on every
  getServerSnapshot call (Object.is would never match, causing
  hydration churn)
- Extract getClientParamsSnapshot/getServerParamsSnapshot named
  functions for consistency with usePathname/useSearchParams
- Extract subscribeToNavigation helper to deduplicate the identical
  subscribe callback across all three hooks
2026-03-12 09:23:10 +00:00
..
2026-02-24 09:29:39 -06:00