mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
try to fix reactivity
This commit is contained in:
parent
52240c674f
commit
e6fdda5220
2 changed files with 6 additions and 6 deletions
|
@ -62,11 +62,11 @@
|
|||
</div>
|
||||
|
||||
<SelectableTileGroup
|
||||
selectedValues="{selectedValues3}"
|
||||
bind:selectedValues="{selectedValues3}"
|
||||
legend="Select the options you require"
|
||||
>
|
||||
{#each selectedValues3_control as item}
|
||||
<SelectableTile value="{item.value}" bind:selected="{item.selected}">
|
||||
<SelectableTile value="{item.value}" selected="{item.selected}">
|
||||
{item.value}
|
||||
</SelectableTile>
|
||||
{/each}
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
_light: light,
|
||||
selectedValues: _selectedValues,
|
||||
update: ({ selected, value }) =>
|
||||
_selectedValues.update((_) => {
|
||||
if (_.includes(value) && !selected) {
|
||||
return _.filter((i) => i !== value);
|
||||
_selectedValues.update((s) => {
|
||||
if (s.includes(value) && !selected) {
|
||||
return s.filter((i) => i !== value);
|
||||
}
|
||||
return selected ? [..._, value] : _; // else no update
|
||||
return selected ? [...s, value] : s; // else no update
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue