Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Filter pre-existing selections from options #1760

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading