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
Commit 245228c
Browse filesBrowse the repository at this point in the historyBrowse files
committed
fix(solid-router): give observe navigations the location's path, search and hash
`to` and `from` on a navigation's NavigationRef, the initial record's `to`,
and the server render's RenderEvent.route.to were the location's pathname,
so `/users/42?tab=posts#bio` and `/users/42` were one destination. Solid
Router gives the location as the router holds it: pathname + search + hash
on the client (browser history's `get()`, `memoryHistory`'s entry, and the
navigate target `url.pathname + url.search + url.hash`), pathname + search
on the server (`staticIntegration`: a request carries no hash).
TanStack's ParsedLocation.href is exactly that shape (pathname +
stringified search + `#hash`), in the router's own path space, the one
`name` (the route's fullPath) is in, before a basepath or rewrite is
applied (`publicHref`). Use it for all three.
Co-authored-by: Claude <[email protected]>
Co-authored-by: Cursor <[email protected]>
Copy file name to clipboardExpand all lines: .changeset/solid-router-observe-initial-route.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,6 @@
2
2
'@tanstack/solid-router': patch
3
3
---
4
4
5
-
Observe tier (Solid's dev and observe builds only): the router declares the route the document arrived on, with the same `OBSERVE.attribution.withOrigin` call it makes for every navigation, around the work in `RouterProvider` that establishes its initial match (`initial: true` on the ref), on both sides. On the client this is the first `"navigation"` record (`initial: true`, `at` the document's navigation start, no write to wait for), kept out of `feedback().navigations`; on the server the same declaration names the request's `"render"` record (`RenderEvent.route`: the matched route's `fullPath`, the pathname, the params), read when the render settles, so a render whose provider ran the load names the location it resolved. A consumer naming page loads and requests by route (`/users/$id` rather than one name per user) had this for every navigation but the first; now it has the first too.
5
+
Observe tier (Solid's dev and observe builds only): the router declares the route the document arrived on, with the same `OBSERVE.attribution.withOrigin` call it makes for every navigation, around the work in `RouterProvider` that establishes its initial match (`initial: true` on the ref), on both sides. On the client this is the first `"navigation"` record (`initial: true`, `at` the document's navigation start, no write to wait for), kept out of `feedback().navigations`; on the server the same declaration names the request's `"render"` record (`RenderEvent.route`: the matched route's `fullPath`, the path and search, the params), read when the render settles, so a render whose provider ran the load names the location it resolved. A consumer naming page loads and requests by route (`/users/$id` rather than one name per user) had this for every navigation but the first; now it has the first too.
6
6
7
7
The Transitioner committing the canonical form of the arrival location (search defaults, trailing slash) is part of the arrival, not a navigation: a router loaded before it mounted no longer records it as one, and the next navigation is dated from its own request rather than from that commit. Nothing changes in production, where `OBSERVE` is undefined.
Observe tier (Solid's dev and observe builds only): a navigation's `to` and `from`, the initial record's `to`, and a server render's `RenderEvent.route.to` are the location's path, search and hash (`/users/42?tab=posts#bio`) rather than its pathname, as `@solidjs/router` gives them — its `href`, in the router's own path space, the one `name` is in (before a basepath or rewrite). A request carries no hash, so a render's `to` is the path and search. The name stays the route pattern the pathname matches. Nothing changes in production, where `OBSERVE` is undefined.
0 commit comments