SIGN IN SIGN UP
sveltejs / svelte UNCLAIMED

web development for the rest of us

0 0 70 JavaScript

fix: propagate async @const blockers through closure references (#18309)

Right now, if you have the following:

```svelte
{@const data = await foo}
<p>{(() => data)()}<p>
```

It will blow up during CSR, because it tries to read `data` before it
exists. The solution to this is to consider references inside closures
as blockers for those closures. This _does_ mean we'll overblock in some
circumstances, such as:

```svelte
{@const data = await foo}
<button onclick={() => data}>foo<button>
```

But I wonder if that's actually incorrect? If the user were to click
`onclick` before `data` is ready, it would blow up.

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
E
Elliott Johnson committed
e705369dee060e74ad9456e45824f36b1ee3c6cf
Parent: ec08dbc
Committed by GitHub <noreply@github.com> on 5/27/2026, 6:41:35 PM