As far as I understand (correct me if that's not the case), one of the points of integration getter is to return any location based on business logic that might not correlate to window.location or other state of the world. But current flow is like this:
User is on /posts
User clicks on <a href="/post/1">
location is set to /post/1 (setReference(resolvedTo))
all useLocation are triggered
/post/1 component is ran/rendered
integration getter runs, returns /post for example
Describe the bug
Reference signal value is set in
navigateFromRoute
: https://github.com/solidjs/solid-router/blob/79a2b577564772b8248aa75c5300dcb61e650e59/src/routing.ts#L395 Location signal is subscribed to it which means that it triggers alluseLocation
, etc that subscribe to location, including route selection/rendering. Issue manifests when custom router integration is used, its getter function runs AFTER settingreference
.As far as I understand (correct me if that's not the case), one of the points of integration getter is to return any location based on business logic that might not correlate to
window.location
or other state of the world. But current flow is like this:/posts
<a href="/post/1">
location
is set to/post/1
(setReference(resolvedTo)
)useLocation
are triggered/post/1
component is ran/rendered/post
for exampleuseLocation
are triggered again/post
component is ran/renderedYour Example Website or App
https://codesandbox.io/s/solid-app-router-example-forked-25ysls?file=/Index.js
Steps to Reproduce the Bug or Issue
/
) if not already therePost X (modal)
linksYou should see in console logs:
[router 1] useLocation
with pathpost/:id
(set bynavigateFromRoute
)[router 1] useLocation
with path/
(set by integration getter)Expected behavior
I'd expect integration getter to be the source of truth without any side-effects nor extra work.
Screenshots or Videos
No response
Platform
Additional context
No response