You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
usePathname / useSearchParams change at popstate, before the destination tree commits; one 'committed entry' for URL, params and location state #1031
On back/forward, usePathname() and useSearchParams() change at popstate, before the destination tree commits. When the destination needs a fetch, the old tree renders with the new pathname and search params until the response lands. #1029 fixed the same ordering for useLocationState; pathname, search params and params are still written at different moments.
Where
Traced by reading main plus the #1029 branch; not yet pinned by a failing test.
packages/rangojs-router/src/browser/navigation-bridge.ts (around line 578): the controller's location is set in the popstate handler.
packages/rangojs-router/src/browser/react/NavigationProvider.tsx (around lines 429 and 465): params and route state are flushed with the payload.
packages/rangojs-router/src/browser/react/use-pathname.ts, use-search-params.ts: read the controller's location, so they move when the handler runs.
packages/rangojs-router/src/client-urls/optimistic-location.ts: the one place where "the entry this tree shows" already exists as a single value, merged by hand in each hook.
Direction
One concept, "the committed entry": the history entry whose tree is on screen, carrying URL, params and location state together. Either a single controller commit (commitEntry({ url, params, state, traversal })) that every hook reads, or the entry held in NavigationProvider's state next to the payload and delivered by context, which gives "an entry's values appear only with that entry's tree" by construction, including for a component that first mounts while a navigation is pending.
Notes
Push and replace navigations are not affected: their location is committed with the payload.
A change here alters when existing hooks update, so it needs its own before/after table and render-count pins.
Activity
fix(router): location state belongs to the entry on screen; evicted s…
fix(router): on back/forward, usePathname and useSearchParams change …