Skip to content

Commit

Permalink
🐛 Filter pre-existing selections from options
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Bolton <[email protected]>

Signed-off-by: Ian Bolton <[email protected]>
  • Loading branch information
ibolton336 committed Mar 20, 2024
1 parent da9da4c commit 0a6f572
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions client/src/app/components/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ export const Autocomplete: React.FC<IAutocompleteProps> = ({
}, [options, selections]);

const filteredOptions = useMemo(() => {
// No input so do not filter!
if (!inputValue) {
return options;
}

// filter to choose options that are 1. NOT selected, and 2. include the inputValue
return options.filter(
({ id, name }) =>
selections.findIndex((s) => s.id === id) === -1 &&
Expand Down Expand Up @@ -191,7 +185,6 @@ export const Autocomplete: React.FC<IAutocompleteProps> = ({
if (!event || !itemId) {
return;
}

event.stopPropagation();
focusTextInput(true);
addSelectionByItemId(itemId);
Expand Down

0 comments on commit 0a6f572

Please sign in to comment.