-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Router changes the URL prematurely #2870
Comments
Can confirm it happens with me as well. |
Explanation of why the current behaviour is intentional: #2917 (comment) |
Given the split in opinions regarding the URL change behavior, could this be added as a configuration option? |
But since the browser's built-in behavior is the opposite (see second GIF in #2870 (comment)), IMHO it should be the other way around, with the URL not updating until after |
I wonder, if we did want to mirror the browser behavior, if the most analogous place to update the url would be in between the network fetch and dom rendering, which I think would be here:
|
Did a reverse ferret on this — |
Describe the bug
When using links within the SvelteKit app, the URL gets updated immediately, even though the underlying page is still loading. In this simple demonstration the second-page loads for 1s, but the URL is updated a immediately:
This is unconventional and results in asynchrony between the URL and the page content.
For contrast, here is what happens when clicking on the second link with rel="external", which triggers normal browser behavior:
Here you can see that both the URL and the page change at the same time. The page represents the URL at every moment. This behavior and universal across browsers.
SvelteKit mimicks browser behavior with History API. To do it correctly, the URL needs to be changed after the page is loaded.
Reproduction
Stackblitz
Source Code
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: