diff --git a/app/(app)/hierarchy/_components/direction-select.tsx b/app/(app)/hierarchy/_components/direction-select.tsx index a8c0291..01ee718 100644 --- a/app/(app)/hierarchy/_components/direction-select.tsx +++ b/app/(app)/hierarchy/_components/direction-select.tsx @@ -37,7 +37,7 @@ export function DirectionSelect(props: DirectionSelectProps): ReactNode { @@ -45,14 +45,14 @@ export function DirectionSelect(props: DirectionSelectProps): ReactNode { {(item) => { return ( {({ isSelected }) => { return ( {isSelected ? ( - + (null); - // eslint-disable-next-line @typescript-eslint/unbound-method - const { contains } = useFilter({ sensitivity: "base" }); - - // FIXME: autocomplete should filter server-side, i.e. in typesense - const filteredOptions = useMemo(() => { - const filteredOptions = []; - - for (const option of options.values()) { - if (contains(option.label, searchTerm)) { - filteredOptions.push(option); - if (filteredOptions.length === 10) break; - } - } - - return filteredOptions; - }, [options, searchTerm, contains]); + const allOptions = useMemo(() => { + return Array.from(options.values()).slice(0, 2500); + }, [options]); - /** - * When a user clicks a node in the visualisation, the selectedKey will change and we need to - * sync the input value of the controlled combobox. - */ - useEffect(() => { - setSearchTerm(getLabel(selectedKey)); - }, [selectedKey, getLabel]); + const layout = useMemo(() => { + return new ListLayout({ rowHeight: 52 }); + }, []); return ( { - setSearchTerm(searchTerm); - setMenuTrigger("input"); - }} - onOpenChange={(_isOpen, menuTrigger) => { - setMenuTrigger(menuTrigger ?? null); - }} - onSelectionChange={(id: Key | null) => { - onSelectionChange(id); - setSearchTerm(getLabel(id as number | null)); - }} + onSelectionChange={onSelectionChange} selectedKey={selectedKey} >
- +
- - {(item: AutocompleteItem) => { - return ( - - {({ isSelected }) => { - return ( - - {isSelected ? ( - - - - ) : null} -
- {item.label} - {legendLabels[item.kind]} -
-
- ); - }} -
- ); - }} -
+ + + {(item: AutocompleteItem) => { + return ( + + {({ isSelected }) => { + return ( + + {isSelected ? ( + + + + ) : null} +
+ {item.label} + + {legendLabels[item.kind]} + +
+
+ ); + }} +
+ ); + }} +
+
); diff --git a/app/(app)/hierarchy/_components/graph-type-select.tsx b/app/(app)/hierarchy/_components/graph-type-select.tsx index 06a0044..0104e6e 100644 --- a/app/(app)/hierarchy/_components/graph-type-select.tsx +++ b/app/(app)/hierarchy/_components/graph-type-select.tsx @@ -41,7 +41,7 @@ export function GraphTypeSelect(props: GraphTypeSelectProps): ReactNode { @@ -49,14 +49,14 @@ export function GraphTypeSelect(props: GraphTypeSelectProps): ReactNode { {(item) => { return ( {({ isSelected }) => { return ( {isSelected ? ( - + { return (