Skip to content

Preload data on async Svelte breaks reactivity #15064

@hyunbinseo

Description

@hyunbinseo

Will be fixed by sveltejs/svelte#17362 and sveltejs/svelte#17335

Describe the bug

Hovering then clicking on the anchor

<!-- src\routes\+page.svelte -->

<script>
  import { resolve } from '$app/paths';
</script>

<a href={resolve('/blog/[slug]', { slug: 'lorem' })}>Preload Enabled</a>

breaks reactivity. {now} is not updated.

<!-- src\routes\blog\[slug]\+page.svelte -->

<script>
  import Component from './Component.svelte';
</script>

<Component>
  {#snippet snippet({ now })}
    {now}
  {/snippet}
</Component>

Reproduction

https://github.com/hyunbinseo/svelte-kit-15064

System Info

System:
  OS: Windows 11 10.0.26200
  CPU: (8) x64 Intel(R) Core(TM) Ultra 7 258V
  Memory: 5.20 GB / 31.48 GB
Binaries:
  Node: 24.12.0 - C:\Users\hyunb\AppData\Local\fnm_multishells\14132_1765800295302\node.EXE
  Yarn: 1.22.22 - C:\Users\hyunb\AppData\Local\fnm_multishells\14132_1765800295302\yarn.CMD
  npm: 11.6.2 - C:\Users\hyunb\AppData\Local\fnm_multishells\14132_1765800295302\npm.CMD
  pnpm: 10.25.0 - C:\Users\hyunb\AppData\Local\fnm_multishells\14132_1765800295302\pnpm.CMD
  Deno: 2.4.0 - C:\Users\hyunb\.deno\bin\deno.EXE
Browsers:
  Chrome: 143.0.7499.109
  Edge: Chromium (140.0.3485.54)
  Firefox: 146.0 - C:\Program Files\Mozilla Firefox\firefox.exe
npmPackages:
  @sveltejs/adapter-auto: ^7.0.0 => 7.0.0
  @sveltejs/kit: ^2.49.2 => 2.49.2
  @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1
  svelte: ^5.46.0 => 5.46.0
  vite: ^7.3.0 => 7.3.0

Severity

serious, but I can work around it

Additional Information

I stumbled on an issue that was fixed by removing preloadData similar to this:

but I've failed to create a reproduction for it.

I am using the same Viewer.svelte component with preloadData inside it.

The only difference being whether the server load function uses:

  • import.meta.glob for getting the markdown modules
  • params to select the correct module from above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions