svelte icon indicating copy to clipboard operation
svelte copied to clipboard

Async: breaking bug when hovering a link that has +layout.svelte

Open legowhales opened this issue 5 months ago • 7 comments

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

legowhales avatar Nov 19 '25 15:11 legowhales

yeah im seeing some weird breaking links too, something is definitely buggy with async/fork still

acoyfellow avatar Nov 22 '25 11:11 acoyfellow

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)

janosh avatar Nov 22 '25 17:11 janosh

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.

dummdidumm avatar Nov 26 '25 14:11 dummdidumm

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

sproott avatar Nov 26 '25 18:11 sproott

Minimum reproduction.

What happens:

  1. fork happens. Sets Component to Child2
  2. both the if block AND the if block inside are rerunning. Their branches are each added to skipped_effects.
  3. Fork discards. The outer skipped effect will be marked clean again, but the inner one won't, because it's not reached
  4. part of the graph can now no longer schedule updates because it's "cut off": the schedule_effect logic 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

dummdidumm avatar Nov 27 '25 16:11 dummdidumm

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 avatar Dec 08 '25 20:12 janosh

@janosh still repro'able with #17309

hmnd avatar Dec 09 '25 04:12 hmnd