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): replace the key detail URL entry when a virtual key is rotated (#39471)
yuneng-jiang342e4470c48f
diff --git a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsx b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsxindex 93f860333d8..c69662b69dc 100644--- a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsx+++ b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsx@@ -182,6 +182,8 @@ const lastSearchParam = (onUrlUpdate: Mock<OnUrlUpdateFunction>, name: string) =const lastKeyParam = (onUrlUpdate: Mock<OnUrlUpdateFunction>) => lastSearchParam(onUrlUpdate, "key");+const lastHistoryMode = (onUrlUpdate: Mock<OnUrlUpdateFunction>) => onUrlUpdate.mock.calls.at(-1)?.[0].options.history;+beforeEach(() => {vi.clearAllMocks();@@ -377,6 +379,7 @@ it("clicking the key cell deep-links via ?key=", async () => {await waitFor(() => {expect(lastKeyParam(onUrlUpdate)).toBe(mockKey.token);});+ expect(lastHistoryMode(onUrlUpdate)).toBe("push");});it("renders KeyInfoView when the URL has ?key= for a key on the current page, without refetching it", async () => {@@ -417,6 +420,7 @@ it("repoints ?key= to the rotated hash once the regenerate dialog is dismissed",await waitFor(() => {expect(lastKeyParam(onUrlUpdate)).toBe("rotated-hash-456");});+ expect(lastHistoryMode(onUrlUpdate)).toBe("replace");});it("fetches the key by id when the URL has ?key= for a key not in the loaded page", async () => {diff --git a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsxindex 8ec8b6d0c3f..c424966a0a3 100644--- a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx+++ b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx@@ -217,7 +217,7 @@ export function VirtualKeysTable({ headerActions }: VirtualKeysTableProps) {(updated: Partial<KeyResponse>) => {const rotatedToken = updated.token ?? updated.token_id;if (!rotatedToken || rotatedToken === selectedKeyId) return;- void setSelectedKeyId(rotatedToken);+ void setSelectedKeyId(rotatedToken, { history: "replace" });void refetch();},[refetch, selectedKeyId, setSelectedKeyId],