mirror of https://github.com/sveltejs/svelte
parent
4e847cfd14
commit
523c85bd3d
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'svelte': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
fix: coordinate mount of snippets with await expressions
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
<script>
|
|
||||||
let { children, push } = $props();
|
|
||||||
|
|
||||||
let message = await push('hello from child');
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<p>message: {message}</p>
|
|
||||||
{@render children()}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
import { tick } from 'svelte';
|
|
||||||
import { test } from '../../test';
|
|
||||||
|
|
||||||
export default test({
|
|
||||||
async test({ assert, target }) {
|
|
||||||
const [shift] = target.querySelectorAll('button');
|
|
||||||
|
|
||||||
shift.click();
|
|
||||||
await tick();
|
|
||||||
|
|
||||||
assert.htmlEqual(target.innerHTML, `<button>shift</button><p>loading...</p>`);
|
|
||||||
|
|
||||||
shift.click();
|
|
||||||
await tick();
|
|
||||||
|
|
||||||
assert.htmlEqual(
|
|
||||||
target.innerHTML,
|
|
||||||
`
|
|
||||||
<button>shift</button>
|
|
||||||
<p>message: hello from child</p>
|
|
||||||
<p>hello from parent</p>
|
|
||||||
`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
<script>
|
|
||||||
import Child from './Child.svelte';
|
|
||||||
|
|
||||||
const resolvers = [];
|
|
||||||
|
|
||||||
function push(value) {
|
|
||||||
const { promise, resolve } = Promise.withResolvers();
|
|
||||||
resolvers.push(() => resolve(value));
|
|
||||||
return promise;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<button onclick={() => resolvers.shift()?.()}>shift</button>
|
|
||||||
|
|
||||||
<svelte:boundary>
|
|
||||||
<Child {push}>
|
|
||||||
<p>{await push('hello from parent')}</p>
|
|
||||||
</Child>
|
|
||||||
|
|
||||||
{#snippet pending()}
|
|
||||||
<p>loading...</p>
|
|
||||||
{/snippet}
|
|
||||||
</svelte:boundary>
|
|
||||||
Loading…
Reference in new issue