-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Bug
Copy link
Description
Describe the bug
The data-sveltekit-preload-data="hover" attribute works on initial page load but stops triggering prefetch after client-side navigation when link hrefs change dynamically.
Expected behavior
Prefetch should work consistently regardless of navigation history, as hrefs are valid and component re-renders correctly.
Actual behavior
Prefetch only works on initial page load. After navigation, no __data.json requests occur on hover despite hrefs being correct.
Reproduction
- Create a component with navigation links that update hrefs after navigation
- Set
data-sveltekit-preload-data="hover"globally or explicitly on links - Load page and hover over links → prefetch works (GET
__data.json) - Click link to navigate client-side
- On new page, hover over the same link with updated hrefs → no prefetch occurs
- Workaround: Manual
preloadData()onmouseenterworks reliably
A minimal codebase reproduction:
- Go item 2. Open network tab.
- Hover on next. It will fetch __data.json.
- Click on next.
- Hover on next. It won't fetch.
-
- Hover on previous, and then next. It will fetch. 2) Or just click next and it will fetch but not upon hover.
Logs
System Info
System:
OS: Linux 6.18 Arch Linux
CPU: (16) x64 AMD Ryzen 7 7730U with Radeon Graphics
Memory: 3.82 GB / 14.96 GB
Container: Yes
Shell: 5.3.9 - /usr/bin/bash
Binaries:
Node: 22.20.0 - /home/emincan/.config/nvm/versions/node/v22.20.0/bin/node
npm: 10.9.3 - /home/emincan/.config/nvm/versions/node/v22.20.0/bin/npm
pnpm: 10.20.0 - /home/emincan/.local/share/pnpm/pnpm
bun: 1.3.0 - /home/emincan/.bun/bin/bun
Browsers:
Chromium: 143.0.7499.192
npmPackages:
@sveltejs/adapter-cloudflare: ^7.2.4 => 7.2.4
@sveltejs/kit: ^2.49.4 => 2.49.4
@sveltejs/vite-plugin-svelte: ^6.2.4 => 6.2.4
svelte: ^5.46.3 => 5.46.3
vite: ^7.3.1 => 7.3.1Severity
annoyance
Additional Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels