Skip to content

Commit f818ec1

Browse files
dylan1951dylanRich-Harris
authored
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>
1 parent 4e45ffa commit f818ec1

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

.changeset/clean-toes-joke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: each block losing reactivity when items removed while promise pending
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { tick } from 'svelte';
2+
import { test } from '../../test';
3+
4+
export default test({
5+
async test({ assert, target }) {
6+
await tick(); // settle initial await
7+
8+
const checkBox = target.querySelector('input');
9+
10+
checkBox?.click();
11+
await tick();
12+
assert.htmlEqual(
13+
target.innerHTML,
14+
`
15+
<input type="checkbox"/>
16+
<p>true</p>
17+
`
18+
);
19+
}
20+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script>
2+
let checked = $state(false);
3+
4+
const foo = $derived(await checked);
5+
</script>
6+
7+
<input type="checkbox" bind:checked />
8+
9+
{#each checked === foo && [1]}
10+
<p>{checked}</p>
11+
{/each}

0 commit comments

Comments
 (0)