sveltejs/svelte

Svelte 5.36.0 breaks reactive behaviour after navigating

Opened this issue · 1 comments

Describe the bug

Since svelte 3.60.0 reactivity seems to break after navigating away from a page and than back.
I've provided an example of the problem in the Reproduction section below.

Reproduction

See instructions on: https://stackblitz.com/edit/svelte-5-36-0-problem

In the example you click on a link and the name of that link is shown in the field above.
When navigating away from that page and back, you click again on the links.
The first time you click on the name the field again reactively updates, but the second time (and any time after that) it doesn't update anymore.

On svelte 5.35.7 it still works: https://stackblitz.com/edit/svelte-5-35-7

Workaround

Adding data-sveltekit-reload to the navigation link forces a full page reload and avoids the issue entirely.
Here's the workaround: https://stackblitz.com/edit/svelte-5-36-0-workaround

Logs

No feedback is provided in the console.

System Info

Using Chrome to test.

 System:
    OS: macOS 15.6.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 208.39 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.19.4 - /opt/homebrew/opt/node@20/bin/node
    npm: 10.8.2 - /opt/homebrew/opt/node@20/bin/npm
  Browsers:
    Brave Browser: 141.1.83.118
    Chrome: 141.0.7390.123
    Firefox: 144.0
    Safari: 18.6
  npmPackages:
    svelte: 5.36.0 => 5.36.0

Severity

blocking an upgrade

After further debugging i found that this seems to be related to client side routing.
Adding data-sveltekit-reload to the navigation link forces a full page reload and avoids the issue entirely.
Here's the workaround: https://stackblitz.com/edit/svelte-5-36-0-workaround

Updated the original description with a workaround paragraph.