Closed oedotme closed 1 month ago
Latest commit: 2e90de51745ee0b07043eaa2fbc938c754e61711
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Thanks.
Prior to
v0.13.3
, it seems the router source value was triggered twice when navigating between differentpaths
.In the first run,
next
has bothpath + state
values, and in the second run, it has only thepath
value:https://github.com/solidjs/solid-router/blob/57847624fb673003f6f0d8261ca7352ff00e7480/src/routers/createRouter.ts#L39-L42
It seems after introducing the state detection fix at #405, it surfaced this behavior — see #416 issue:
https://github.com/solidjs/solid-router/blob/57847624fb673003f6f0d8261ca7352ff00e7480/src/routing.ts#L344-L358
As the
start
function was only running once as thepath
hasn't changed in the second run. But nowstart
runs twice which causes thestate
to reset toundefined
unexpectedly.I've noticed the behavior is different when setting
replace: true
while navigating. Changing theHashRouter
set
function to usewindow.history.pushState(...)
seems to fix it forreplace: false
(default):https://github.com/solidjs/solid-router/blob/57847624fb673003f6f0d8261ca7352ff00e7480/src/routers/HashRouter.ts#L27-L31
Closes #416