mirror of https://github.com/sveltejs/svelte
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 #17529pull/17531/head
parent
9108404450
commit
6046bbb456
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: export `wait` function from internal client index
|
||||
@ -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…
Reference in new issue