$page.url.pathname
is inconsistent when using paths.base
#10125
Labels
bug
Something isn't working
paths.base
bugs relating to `config.kit.paths.base`
ready to implement
please submit PRs for these issues!
Describe the bug
While writing the reproduction for #10124 I discovered another bug in SvelteKit. When you set the
paths.base
insidesvelte.config.js
theapp/stores
's$page.url
becomes inconsistent. When initially calling the base likehttp://example.com/base
it will redirect your browser tohttp://example.com/base/
and$page.url
will be set to that too. Anyway as soon as hydration kicks in the$page.url
will be set tohttp://example.com/base
even if the browser url bar still showshttp://example.com/base/
. As far as I can tell this behavior is only present at the root of the base. Sub Routes likehttp://example.com/base/about
are always redirected to the none slash version and therefore don't seem to have this bug.Reproduction
Repository showcasing the bug in code: https://github.com/UnlimitedBytes/sveltekit-paths-base-bug
Because of the speed at which the hydration process happens it's very hard to see the change in
$page.url
by just looking at the current value. So I recommend you open up the source code viewer for the page and search forURL of the current site:
. This will take you directly to the$page.url
which is outputted. You can then see that the URL in the HTML source code ends with a slash while the URL displayed on the page (after hydration) doesn't contain an ending slash.Logs
System Info
Severity
annoyance
Additional Information
Not needed.
The text was updated successfully, but these errors were encountered: