From 680252598c54c5601585d2b909430686a722835e Mon Sep 17 00:00:00 2001 From: mlogclub Date: Mon, 25 May 2026 12:51:41 +0800 Subject: [PATCH] feat: enhance OptionCombobox with open state management and close on selection --- .../ai-configs/_components/option-combobox.tsx | 9 +++++++-- web/components/option-combobox.tsx | 10 +++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/web/app/dashboard/ai-configs/_components/option-combobox.tsx b/web/app/dashboard/ai-configs/_components/option-combobox.tsx index fabe463..71f9e18 100644 --- a/web/app/dashboard/ai-configs/_components/option-combobox.tsx +++ b/web/app/dashboard/ai-configs/_components/option-combobox.tsx @@ -1,6 +1,7 @@ "use client" import { CheckIcon, ChevronsUpDownIcon } from "lucide-react" +import { useState } from "react" import { Button } from "@/components/ui/button" import { @@ -44,11 +45,12 @@ export function OptionCombobox({ onChange, }: OptionComboboxProps) { const t = useI18n() + const [open, setOpen] = useState(false) const selectedLabel = options.find((option) => option.value === value)?.label ?? placeholder return ( - + onChange(option.value)} + onSelect={() => { + onChange(option.value) + setOpen(false) + }} > option.value === value)?.label ?? placeholder return ( - + onChange(option.value)} + onSelect={() => { + onChange(option.value) + setOpen(false) + }} >