SIGN IN SIGN UP
sveltejs / svelte UNCLAIMED

web development for the rest of us

0 0 70 JavaScript

fix: correctly coordinate component-level effects inside async blocks (#18260)

While looking at the reproduction in
https://github.com/sveltejs/svelte/issues/18221#issuecomment-4497918414
I immediately got greeted with a runtime error when running it in the
playground (weirdly not in the Stackblitz version). The error was that a
component expected a binding to be set in onMount, but the timing of
onMount was wrong.

Turns out it's because our logic to determine whether or not to defer
top level effects is flawed. `REACTION_RAN`, which was used previously,
is already set if the initialized component is inside an async block. We
instead check for `component_context.i` which is set to `true` on
`pop()`.
S
Simon H committed
91a42e2ed6bda52205b269d28e70b9d15cd87292
Parent: 65283bc
Committed by GitHub <noreply@github.com> on 5/21/2026, 6:25:51 PM