Skip to content

Commit

Permalink
fix(MultiSelectStatic): selected items can be duplicated when searchi…
Browse files Browse the repository at this point in the history
…ng already added item (#489)
  • Loading branch information
erickaguilaraiq authored May 3, 2024
1 parent 1fac32d commit 2342459
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/MultiSelect/MultiSelectStatic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export const MultiSelectStatic: React.FC<Props> = ({
.filter(item => {
const itemId = item.name.match(/\d+/)
return (
selectedItems.indexOf(item) < 0 &&
selectedItems.every(selectedItem => selectedItem.id !== item.id) &&
(hasOnlyNumbers(userSearchInput) && itemId && itemId[0]
? itemId[0].startsWith(userSearchInput)
: item.name.toLowerCase().startsWith(userSearchInput))
Expand Down

0 comments on commit 2342459

Please sign in to comment.