From d9bb4328f865ae67597d35c35c31712c425a5e0c Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Sat, 29 Jun 2024 18:12:57 +0200 Subject: [PATCH] chore(website): address Combobox nullable breaking change for headless-ui v2 see https://github.com/tailwindlabs/headlessui/pull/3064 --- website/src/components/SearchPage/SearchFullUI.tsx | 10 ++++++++-- .../components/SearchPage/fields/AutoCompleteField.tsx | 2 +- website/src/types/config.ts | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/website/src/components/SearchPage/SearchFullUI.tsx b/website/src/components/SearchPage/SearchFullUI.tsx index 78b35bd921..7fe012739f 100644 --- a/website/src/components/SearchPage/SearchFullUI.tsx +++ b/website/src/components/SearchPage/SearchFullUI.tsx @@ -15,7 +15,13 @@ import { getLapisUrl } from '../../config.ts'; import { lapisClientHooks } from '../../services/serviceHooks.ts'; import { pageSize } from '../../settings'; import type { Group } from '../../types/backend.ts'; -import { type MetadataFilter, type Schema, type GroupedMetadataFilter, type FieldValues } from '../../types/config.ts'; +import { + type MetadataFilter, + type Schema, + type GroupedMetadataFilter, + type FieldValues, + type SetAFieldValue, +} from '../../types/config.ts'; import { type OrderBy } from '../../types/lapis.ts'; import type { ReferenceGenomesSequenceNames } from '../../types/referencesGenomes.ts'; import type { ClientConfig } from '../../types/runtimeConfig.ts'; @@ -160,7 +166,7 @@ export const InnerSearchFullUI = ({ return values; }, [state, hiddenFieldValues]); - const setAFieldValue = (fieldName: string, value: string | number) => { + const setAFieldValue: SetAFieldValue = (fieldName, value) => { setState((prev: any) => { const newState = { ...prev, diff --git a/website/src/components/SearchPage/fields/AutoCompleteField.tsx b/website/src/components/SearchPage/fields/AutoCompleteField.tsx index 25b7a12999..2532c72743 100644 --- a/website/src/components/SearchPage/fields/AutoCompleteField.tsx +++ b/website/src/components/SearchPage/fields/AutoCompleteField.tsx @@ -10,7 +10,7 @@ type AutoCompleteFieldProps = { field: MetadataFilter | GroupedMetadataFilter; setAFieldValue: SetAFieldValue; lapisUrl: string; - fieldValue?: string | number; + fieldValue?: string | number | null; lapisSearchParameters: Record; }; diff --git a/website/src/types/config.ts b/website/src/types/config.ts index 1f746d4426..46b87161d3 100644 --- a/website/src/types/config.ts +++ b/website/src/types/config.ts @@ -117,5 +117,5 @@ export const websiteConfig = z.object({ }); export type WebsiteConfig = z.infer; -export type FieldValues = Record; -export type SetAFieldValue = (fieldName: string, value: string | number) => void; +export type FieldValues = Record; +export type SetAFieldValue = (fieldName: string, value: string | number | null) => void;