Skip to content

Commit

Permalink
fix(MultiSelectProvider.tsx): double addition on mobile (#817)
Browse files Browse the repository at this point in the history
* fix(MultiSelectProvider.tsx): double addition on mobile

* chore: remove nullish operator

---------

Co-authored-by: KishenKumarrrrr <[email protected]>
  • Loading branch information
KishenKumarrrrr and KishenKumarrrrr authored Dec 11, 2024
1 parent 0b2009c commit dfe6aa8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/camp/src/MultiSelect/MultiSelectProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,13 @@ export const MultiSelectProvider = ({
} = useMultipleSelection<(typeof items)[0]>({
selectedItems,
onSelectedItemsChange: ({ selectedItems }) => {
onChange(
selectedItems
?.filter((item) => !isItemDisabled(item))
.map(itemToValue) ?? [],
)
onChange([
...new Set(
selectedItems
?.filter((item) => !isItemDisabled(item))
.map(itemToValue),
),
])
},
itemToString: itemToLabelString,
stateReducer: (_state, { changes, type }) => {
Expand Down

0 comments on commit dfe6aa8

Please sign in to comment.