mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 19:46:36 +00:00
try to fix reactivity
This commit is contained in:
parent
8431b58891
commit
172f54ea31
1 changed files with 6 additions and 4 deletions
|
@ -26,11 +26,13 @@
|
|||
_light: light,
|
||||
selectedValues: _selectedValues,
|
||||
update: ({ selected, value }) =>
|
||||
_selectedValues.update((s) => {
|
||||
if (s.includes(value) && !selected) {
|
||||
return s.filter((i) => i !== value);
|
||||
_selectedValues.update((values) => {
|
||||
if (values.includes(value) && !selected) {
|
||||
return values.filter((i) => i !== value);
|
||||
} else if (selected && !values.includes(value)) {
|
||||
return [...s, value];
|
||||
}
|
||||
return selected ? [...s, value] : s; // else no update
|
||||
return s;
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue