From dfe6aa8cbc35e8ba463ecd83456fda3d32aa128c Mon Sep 17 00:00:00 2001 From: Kishen Kumar Date: Wed, 11 Dec 2024 14:25:35 +0800 Subject: [PATCH] fix(MultiSelectProvider.tsx): double addition on mobile (#817) * fix(MultiSelectProvider.tsx): double addition on mobile * chore: remove nullish operator --------- Co-authored-by: KishenKumarrrrr --- .../camp/src/MultiSelect/MultiSelectProvider.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/camp/src/MultiSelect/MultiSelectProvider.tsx b/packages/camp/src/MultiSelect/MultiSelectProvider.tsx index bcb43d56..ff19e65e 100644 --- a/packages/camp/src/MultiSelect/MultiSelectProvider.tsx +++ b/packages/camp/src/MultiSelect/MultiSelectProvider.tsx @@ -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 }) => {