The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(ui): hold the delete dialog open mid-deletion and keep unmatched select values
Yuneng Jiang362875a7e695
diff --git a/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.test.tsx b/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.test.tsxindex e27a60cc866..465f7fcfcf0 100644--- a/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.test.tsx+++ b/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.test.tsx@@ -159,6 +159,20 @@ describe("DeleteResourceModal", () => {expect(cancelButton).toBeDisabled();});+ it("should call onCancel when escape is pressed and no deletion is in flight", async () => {+ const user = userEvent.setup();+ renderWithProviders(<DeleteResourceModal {...defaultProps} />);+ await user.keyboard("{Escape}");+ expect(mockOnCancel).toHaveBeenCalled();+ });++ it("should ignore escape while confirmLoading is true so the modal cannot close mid-deletion", async () => {+ const user = userEvent.setup();+ renderWithProviders(<DeleteResourceModal {...defaultProps} confirmLoading={true} />);+ await user.keyboard("{Escape}");+ expect(mockOnCancel).not.toHaveBeenCalled();+ });+it("should disable delete button when confirmLoading is true even if requiredConfirmation matches", async () => {const user = userEvent.setup();renderWithProviders(<DeleteResourceModal {...defaultProps} confirmLoading={true} requiredConfirmation="DELETE" />);diff --git a/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.tsx b/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.tsxindex b45f164b2a5..42baae3d86c 100644--- a/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.tsx+++ b/ui/litellm-dashboard/src/components/common_components/DeleteResourceModal.tsx@@ -44,7 +44,7 @@ export default function DeleteResourceModal({}, [isOpen]);return (- <Dialog open={isOpen} onOpenChange={(open) => !open && onCancel()}>+ <Dialog open={isOpen} onOpenChange={(open) => !open && !confirmLoading && onCancel()}><DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto"><DialogHeader><DialogTitle>{title}</DialogTitle>diff --git a/ui/litellm-dashboard/src/components/shared/SearchSelect.test.tsx b/ui/litellm-dashboard/src/components/shared/SearchSelect.test.tsxindex acf50d282b4..5e8d63eda08 100644--- a/ui/litellm-dashboard/src/components/shared/SearchSelect.test.tsx+++ b/ui/litellm-dashboard/src/components/shared/SearchSelect.test.tsx@@ -21,6 +21,13 @@ describe("SearchSelect", () => {expect(screen.getByRole("combobox")).toHaveValue("Growth");});+ it("shows a value the options do not carry yet instead of blanking the field", () => {+ const { rerender } = render(<SearchSelect options={[]} value="team-2" onValueChange={vi.fn()} />);+ expect(screen.getByRole("combobox")).toHaveValue("team-2");+ rerender(<SearchSelect options={OPTIONS} value="team-2" onValueChange={vi.fn()} />);+ expect(screen.getByRole("combobox")).toHaveValue("Growth");+ });+it("shows a clear control only when a value is selected", () => {const { rerender } = render(<SearchSelect options={OPTIONS} onValueChange={vi.fn()} />);expect(document.querySelector('[data-slot="combobox-clear"]')).toBeNull();diff --git a/ui/litellm-dashboard/src/components/shared/SearchSelect.tsx b/ui/litellm-dashboard/src/components/shared/SearchSelect.tsxindex 1bfc19cbbe2..c6ae11f5729 100644--- a/ui/litellm-dashboard/src/components/shared/SearchSelect.tsx+++ b/ui/litellm-dashboard/src/components/shared/SearchSelect.tsx@@ -43,11 +43,16 @@ export function SearchSelect({className,inputId,}: SearchSelectProps) {- const selected = options.find((option) => option.value === value) ?? null;+ const selected =+ value === undefined || value === ""+ ? null+ : options.find((option) => option.value === value) ?? { label: value, value };+ const items =+ selected !== null && !options.some((option) => option.value === selected.value) ? [selected, ...options] : options;return (<Combobox- items={options}+ items={items}value={selected}onValueChange={(item: SearchSelectOption | null) => onValueChange(item?.value ?? "")}isItemEqualToValue={(a: SearchSelectOption, b: SearchSelectOption) => a.value === b.value}