kit
kit copied to clipboard
clicking link while onNavigate is pending toggles the URL
Describe the bug
Hello,
I've a weird issue, when i return promise on onNavigation, until the promise was resolve, if i "re-click" on the same link, the url "toggle"
Here a video
https://github.com/user-attachments/assets/efbf3657-e62e-4d50-b59f-f5ca78415dc2
Reproduction
https://github.com/stephanedemotte/svelte-routing-bug
Logs
No response
System Info
System:
OS: macOS 14.6.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 562.87 MB / 16.00 GB
Shell: 3.1.2 - /usr/local/bin/fish
Binaries:
Node: 22.6.0 - /usr/local/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 10.8.2 - /usr/local/bin/npm
pnpm: 9.7.0 - ~/Library/pnpm/pnpm
Browsers:
Chrome: 129.0.6668.100
Safari: 18.0.1
npmPackages:
@sveltejs/adapter-auto: ^3.0.0 => 3.2.5
@sveltejs/kit: ^2.0.0 => 2.7.0
@sveltejs/vite-plugin-svelte: ^4.0.0-next.6 => 4.0.0-next.8
svelte: ^5.0.0-next.1 => 5.0.0-next.264
vite: ^5.0.3 => 5.4.9
Severity
blocking an upgrade
Additional Information
No response
I've tested this and it happens on Svelte 4 too
@eltigerchino any news on this ? relative "big" issue no ?
I'm so sorry. This definitely slipped through and I forgot about it. I'm currently investigating it and a solution seems close.
Something is setting the URL to the previous URL when we click on the link to a page while also navigating to it. In this case, it's suppose to simply call replaceState with the same URL but internally the URL is being resolved incorrectly in the client router's get_navigation_result_from_branch method.