You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/packages/svelte/tests/runtime-runes/samples/props-equality/main.svelte

20 lines
509 B

<script>
import Item from './item.svelte'
let items = $state([{name: 'a'}, {name: 'b'}]);
</script>
<!-- test that each block doesn't mess with item identity -->
{#each items as item (item)}
<Item {item} {items} onclick={() => item.name = item.name + '+'} />
{/each}
{#each items as item (item.name)}
<Item {item} {items} onclick={() => {console.log('hello'); item.name = item.name + '+'}} />
{/each}
{#each items as item}
<Item {item} {items} onclick={() => item.name = item.name + '+'} />
{/each}