fix: export `wait` function from internal client index (#17530)

PR #17461 added the `wait` function to `reactivity/async.js` and modified the compiler to generate `$.wait()` calls, but forgot to export it from `index.js`.

This causes a runtime error when using `await` inside `$derived()` with `experimental.async: true`:

```
TypeError: $.wait is not a function
```

Fixes #17529
pull/17531/head
Benjamin Tamasi 4 days ago committed by GitHub
parent 9108404450
commit 6046bbb456
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: export `wait` function from internal client index

@ -103,7 +103,8 @@ export {
run,
save,
track_reactivity_loss,
run_after_blockers
run_after_blockers,
wait
} from './reactivity/async.js';
export { eager, flushSync as flush } from './reactivity/batch.js';
export {

@ -0,0 +1,18 @@
import { tick } from 'svelte';
import { test } from '../../test';
export default test({
mode: ['client'],
props: {
a_promise: Promise.resolve(10),
b_promise: Promise.resolve(20)
},
async test({ assert, target }) {
await tick();
await tick();
assert.htmlEqual(target.innerHTML, `<p>30</p>`);
}
});

@ -0,0 +1,16 @@
<script>
let { a_promise, b_promise } = $props();
</script>
<svelte:boundary>
{@const a = await a_promise}
{#if true}
<svelte:boundary>
{@const b = await b_promise}
{#if true}
{@const sum = a + b}
<p>{sum}</p>
{/if}
</svelte:boundary>
{/if}
</svelte:boundary>
Loading…
Cancel
Save