diff --git a/packages/opub-ui/src/components/Combobox/Combobox.tsx b/packages/opub-ui/src/components/Combobox/Combobox.tsx index 7998a492..aa22ec4c 100644 --- a/packages/opub-ui/src/components/Combobox/Combobox.tsx +++ b/packages/opub-ui/src/components/Combobox/Combobox.tsx @@ -190,22 +190,12 @@ export const Combobox = React.forwardRef( // for multi select const selectedArr = e.map((value: string) => { - if (comboboxList.findIndex((item) => item.value === value) > 0) { - return comboboxList.find((item) => item.value === value); - } else { - setComboboxList([ - ...comboboxList, - { - label: value, - value: value, - }, - ]); - - return { + return ( + comboboxList.find((item) => item.value === value) || { label: value, value: value, - }; - } + } + ); }); setSelectedValues(selectedArr);