-
- Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Description
Describe the problem
bind:group can be out of sync with the DOM when the binded input elements are removed.
<script lang="ts"> let selectedItems = ['a', 'b', 'c']; let items = ['a', 'b', 'c']; $: console.log(selectedItems); </script> <!-- This does not update the selectedItems array. --> <!-- Expected: selectedItems becomes [] and is logged. --> <button type="button" on:click={() => (items = [])}>Remove all items</button> {#each items as item (item)} <label> <input type="checkbox" value={item} bind:group={selectedItems} /> <span>{item}</span> </label> {/each}https://svelte.dev/repl/96dcce0d2426459c9a08c0fdc105a246?version=4.2.19
Describe the proposed solution
Update bind:group array when the binded input elements are removed
Importance
nice to have
Metadata
Metadata
Assignees
Labels
No labels