From 7b5fb91d47208d525a53164dd426d8dfb3cbac53 Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Sat, 29 Jun 2024 18:26:12 +0200 Subject: [PATCH] chore(website): appease typescript for headlessui v2 upgrade for nullable combobox Headlessui v2 makes it necessary to handle null input for combobox. See https://github.com/tailwindlabs/headlessui/pull/3064 --- website/src/components/SearchPage/fields/MutationField.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/website/src/components/SearchPage/fields/MutationField.tsx b/website/src/components/SearchPage/fields/MutationField.tsx index 46f6b17a7..60e142d4e 100644 --- a/website/src/components/SearchPage/fields/MutationField.tsx +++ b/website/src/components/SearchPage/fields/MutationField.tsx @@ -168,10 +168,14 @@ export const MutationField: FC = ({ 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('');