Skip to content

Commit

Permalink
chore(website): appease typescript for headlessui v2 upgrade for null…
Browse files Browse the repository at this point in the history
…able combobox

Headlessui v2 makes it necessary to handle null input for combobox.

See tailwindlabs/headlessui#3064
  • Loading branch information
corneliusroemer committed Jun 29, 2024
1 parent 4501522 commit 7e61ace
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion website/src/components/SearchPage/fields/MutationField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,14 @@ export const MutationField: FC<MutationFieldProps> = ({ referenceGenomesSequence
setOptions(newOptions);
};

const handleOptionClick = (option: MutationQuery[] | MutationQuery) => {
const handleOptionClick = (option: MutationQuery[] | MutationQuery | null) => {
if (Array.isArray(option)) {
option = option[0];
}
// Unclear how to handle null here, necessary since headlessui v2
if (!option) {
return;
}
const newSelectedOptions = [...selectedOptions, option];
onChange(serializeMutationQueries(newSelectedOptions));
setInputValue('');
Expand Down

0 comments on commit 7e61ace

Please sign in to comment.