Skip to content

Commit

Permalink
Fix changing of label while selection and duplicate creation for exis…
Browse files Browse the repository at this point in the history
…ting items in combobox creatable
  • Loading branch information
bhavabhuthi committed Oct 15, 2024
1 parent efdec0b commit 60b3910
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions packages/opub-ui/src/components/Combobox/Combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 60b3910

Please sign in to comment.