-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the bug
When using a link with sveltekit:prefetch that contains an anchor-link e.g. '/blog#modal' the page gets requested on hover, which is the intended behaviour.
But if you then decide to not click on that link and visit the same page without the anchor-link /blog you will see the contents of the link you hovered before.
In this implementation the onMount hook accesses the $page store which holds a wrong value.
I would assume when using prefetch sveltekit only loads the necessary load functions and components.
The $page store should get updated when you actually click on the link.
Reproduction
Here is the link to a Repo showing the issue: https://stackblitz.com/edit/sveltejs-kit-template-default-uubxoo
- load the homepage
- hover over one of the last two links
- click the first link
You should see that the page was loaded with some content that belongs to the other links
Logs
No response
System Info
System:
OS: Windows 10 10.0.22000
CPU: (12) x64 Intel(R) Core(TM) i7-9850H CPU @ 2.60GHz
Memory: 16.90 GB / 31.73 GB
Binaries:
Node: 16.13.2 - ~\AppData\Local\Volta\tools\image\node\16.13.2\node.EXE
Yarn: 1.22.17 - ~\AppData\Local\Volta\tools\image\yarn\1.22.17\bin\yarn.CMD
npm: 8.1.2 - ~\AppData\Local\Volta\tools\image\node\16.13.2\npm.CMD
Browsers:
Edge: Spartan (44.22000.120.0), Chromium (100.0.1185.50), ChromiumDev (99.0.1141.0)
Internet Explorer: 11.0.22000.120
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.37
@sveltejs/kit: next => 1.0.0-next.320
svelte: ^3.46.0 => 3.47.0Severity
serious, but I can work around it
Additional Information
No response