Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$page.url.pathname is inconsistent when using paths.base #10125

Closed
UnlimitedBytes opened this issue Jun 8, 2023 · 1 comment
Closed

$page.url.pathname is inconsistent when using paths.base #10125

UnlimitedBytes opened this issue Jun 8, 2023 · 1 comment
Labels
bug Something isn't working paths.base bugs relating to `config.kit.paths.base` ready to implement please submit PRs for these issues!

Comments

@UnlimitedBytes
Copy link

Describe the bug

While writing the reproduction for #10124 I discovered another bug in SvelteKit. When you set the paths.base inside svelte.config.js the app/stores's $page.url becomes inconsistent. When initially calling the base like http://example.com/base it will redirect your browser to http://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 to http://example.com/base even if the browser url bar still shows http://example.com/base/. As far as I can tell this behavior is only present at the root of the base. Sub Routes like http://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 for URL 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

Not needed.

System Info

Not needed.

Severity

annoyance

Additional Information

Not needed.

@ghostdevv
Copy link
Member

Possible duplicate/related to #9595

@tcc-sejohnson tcc-sejohnson added bug Something isn't working paths.base bugs relating to `config.kit.paths.base` ready to implement please submit PRs for these issues! labels Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working paths.base bugs relating to `config.kit.paths.base` ready to implement please submit PRs for these issues!
Projects
None yet
Development

No branches or pull requests

3 participants