mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 03:26: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>
|
</div>
|
||||||
|
|
||||||
<SelectableTileGroup
|
<SelectableTileGroup
|
||||||
selectedValues="{selectedValues3}"
|
bind:selectedValues="{selectedValues3}"
|
||||||
legend="Select the options you require"
|
legend="Select the options you require"
|
||||||
>
|
>
|
||||||
{#each selectedValues3_control as item}
|
{#each selectedValues3_control as item}
|
||||||
<SelectableTile value="{item.value}" bind:selected="{item.selected}">
|
<SelectableTile value="{item.value}" selected="{item.selected}">
|
||||||
{item.value}
|
{item.value}
|
||||||
</SelectableTile>
|
</SelectableTile>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
@ -26,11 +26,11 @@
|
||||||
_light: light,
|
_light: light,
|
||||||
selectedValues: _selectedValues,
|
selectedValues: _selectedValues,
|
||||||
update: ({ selected, value }) =>
|
update: ({ selected, value }) =>
|
||||||
_selectedValues.update((_) => {
|
_selectedValues.update((s) => {
|
||||||
if (_.includes(value) && !selected) {
|
if (s.includes(value) && !selected) {
|
||||||
return _.filter((i) => i !== value);
|
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