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
When using router.type === 'pathname', all load functions are re-run if a user edits what would be part of $page.url.pathname (the page appears to reload).
When using router.type === 'hash', all load functions are not guaranteed to re-run when a user edits the URL. If the search params are modified, the page reloads and all load functions run. But when any part of the path (now following the hash) is edited, selective invalidation seems to be applied. This leads to inconsistent behavior between the two router types.
I don't know if this distinction between "reload on pathname change, don't reload on hash change" is just a browser thing that SvelteKit has no control over, but it would be nice to have full invalidation on hash changes when using the hash-based router, to mirror what happens with pathname changes and the pathname router.
I can work around this with something like:
<svelte:windowon:hashchange={invalidateAll}/>
but this obviously ends up running some load functions twice.
Reproduction
Open the console when running https://github.com/stephenlrandall/kit-inline-test. Visit http://localhost:5173/?q=svelte#/search, then modify the URL to http://localhost:5173/?q=svelte#/v2/search. Note that in the console, only the search route's load function has been re-run.
Should we trigger a full page reload instead of client-side navigating when the address bar URL is edited so the router behaviours are aligned? cc: @dummdidumm
Describe the bug
When using
router.type === 'pathname'
, allload
functions are re-run if a user edits what would be part of$page.url.pathname
(the page appears to reload).When using
router.type === 'hash'
, allload
functions are not guaranteed to re-run when a user edits the URL. If the search params are modified, the page reloads and allload
functions run. But when any part of the path (now following the hash) is edited, selective invalidation seems to be applied. This leads to inconsistent behavior between the two router types.I don't know if this distinction between "reload on pathname change, don't reload on hash change" is just a browser thing that SvelteKit has no control over, but it would be nice to have full invalidation on hash changes when using the hash-based router, to mirror what happens with pathname changes and the pathname router.
I can work around this with something like:
but this obviously ends up running some load functions twice.
Reproduction
Open the console when running https://github.com/stephenlrandall/kit-inline-test. Visit
http://localhost:5173/?q=svelte#/search
, then modify the URL tohttp://localhost:5173/?q=svelte#/v2/search
. Note that in the console, only thesearch
route's load function has been re-run.Logs
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: