mirror of https://github.com/sveltejs/svelte
fix: run blocks eagerly during flush (#16631)
fixes #16548 --------- Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>pull/16633/merge
parent
7b2d774627
commit
2b85d2a544
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
perf: run blocks eagerly during flush instead of aborting
|
@ -0,0 +1,13 @@
|
|||||||
|
<script>
|
||||||
|
let { children } = $props();
|
||||||
|
|
||||||
|
let inited = $state(false);
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
inited = true;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if inited}
|
||||||
|
<span>{@render children()}</span>
|
||||||
|
{/if}
|
@ -0,0 +1,12 @@
|
|||||||
|
import { flushSync } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const [button] = target.querySelectorAll('button');
|
||||||
|
|
||||||
|
assert.doesNotThrow(() => {
|
||||||
|
flushSync(() => button.click());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,15 @@
|
|||||||
|
<script>
|
||||||
|
import Child from './Child.svelte';
|
||||||
|
|
||||||
|
let show = $state(false);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={() => show = !show}>
|
||||||
|
toggle
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{#if show}
|
||||||
|
{#each { length: 1234 } as i}
|
||||||
|
<Child>{i}</Child>
|
||||||
|
{/each}
|
||||||
|
{/if}
|
Loading…
Reference in new issue