Async: breaking bug when hovering a link that has +layout.svelte
Describe the bug
Since svelte 5.42.0, there is a weird reactivity bug in a very specific situation. Using bits-ui (for example a tooltip), and experimental async, when hovering/preloading a link that points to a page with +layout.svelte, the tooltip freezes. And any other tooltip will not work anymore.
Reproduction
I made a sveltekit project on SvelteLab with everything needed to reproduce the problem: https://www.sveltelab.dev/q30g562x4ns934i
Hope it helps.
Logs
System Info
On macos, sveltelab....
Severity
blocking an upgrade
yeah im seeing some weird breaking links too, something is definitely buggy with async/fork still
same problem over at https://github.com/janosh/matterviz. currently pinned to [email protected]. if i update to 5.42.0+ (including current latest 5.43.14) clicking nav links for page navigation freezes the site (for many but not all pages)
My working theory is that the current graph is getting entangled with the forked graph - i.e. something is scheduled which should be running and commit, but instead it is run in the context of the fork and therefore the UI is not committed / the effects never run.
Could this be related as well? I'm not sure if it's a separate issue or not, but this happens with async and a nested layout. No server or client code, just markup in pages and layouts. Tried downgrading Svelte to 5.41.4 as suggested by @janosh but it didn't help.
EDIT: I also tried downgrading all the way to [email protected] and @sveltejs/[email protected] with no improvement.
https://github.com/sproott/sveltekit-navigation-break
https://github.com/user-attachments/assets/723366de-942f-4e1b-b6a0-893b53db529a
What happens:
- fork happens. Sets
ComponenttoChild2 - both the if block AND the if block inside are rerunning. Their branches are each added to
skipped_effects. - Fork discards. The outer skipped effect will be marked clean again, but the inner one won't, because it's not reached
- part of the graph can now no longer schedule updates because it's "cut off": the
schedule_effectlogic stops at the not-clean branch, thinking "ah the root above this branch already scheduled", but it wasn't
Update: Doesn't even need to be nested blocks, an effect inside the skipped_effect being scheduled already is enough
i just updated to 5.45.6 and seems like this issue is gone? i see a linked debug helper PR but no PR that fixed the actual issue in this thread. was it unintentionally fixed?
EDIT: my bad, i forgot i removed compilerOptions.experimental.async. that's why my issue is gone
@janosh still repro'able with #17309