fix: each block losing reactivity when items removed while promise pending (#17151)

Co-authored-by: dylan <dylanbradshaw107@hotmail.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
pull/17150/head
dylan1951 4 days ago committed by GitHub
parent 4e45ffa613
commit f818ec1aa2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: each block losing reactivity when items removed while promise pending

@ -0,0 +1,20 @@
import { tick } from 'svelte';
import { test } from '../../test';
export default test({
async test({ assert, target }) {
await tick(); // settle initial await
const checkBox = target.querySelector('input');
checkBox?.click();
await tick();
assert.htmlEqual(
target.innerHTML,
`
<input type="checkbox"/>
<p>true</p>
`
);
}
});

@ -0,0 +1,11 @@
<script>
let checked = $state(false);
const foo = $derived(await checked);
</script>
<input type="checkbox" bind:checked />
{#each checked === foo && [1]}
<p>{checked}</p>
{/each}
Loading…
Cancel
Save