Skip to content

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]

fix(ui): split the KeyActivityPanel condition chains to bring the lint budget back under its ceiling (#44114)

devin-ai-integration[bot]2b51f2f94124
diff --git a/ui/litellm-dashboard/eslint-budgets.json b/ui/litellm-dashboard/eslint-budgets.json
index 44294b5fa97..83b7190b355 100644
--- a/ui/litellm-dashboard/eslint-budgets.json
+++ b/ui/litellm-dashboard/eslint-budgets.json
@@ -4,7 +4,7 @@
"complexity": { "max": 140, "target": 80 },
"max-depth": { "max": 70, "target": 30 },
"local/no-large-inline-object-arg": { "max": 551, "target": 300 },
- "local/no-long-condition-chain": { "max": 196, "target": 120 },
+ "local/no-long-condition-chain": { "max": 194, "target": 120 },
"testing-library/no-container": { "max": 133, "target": 50 },
"testing-library/no-node-access": { "max": 707, "target": 500 },
"testing-library/prefer-screen-queries": { "max": 18, "target": 18 }
diff --git a/ui/litellm-dashboard/src/components/UsagePage/components/KeyActivityPanel.tsx b/ui/litellm-dashboard/src/components/UsagePage/components/KeyActivityPanel.tsx
index 47226b1c2e4..ad28a398c83 100644
--- a/ui/litellm-dashboard/src/components/UsagePage/components/KeyActivityPanel.tsx
+++ b/ui/litellm-dashboard/src/components/UsagePage/components/KeyActivityPanel.tsx
@@ -256,9 +256,10 @@ const KeyActivityPanel: React.FC<KeyActivityPanelProps> = ({
const filteredMetrics = useMemo(() => ({ ...searchMetrics, ...localFiltered }), [searchMetrics, localFiltered]);
const shownKeys = Object.keys(filteredMetrics).length;
const isFiltering = trimmedQuery.length > 0;
+ const searchSettled = isFiltering && !searching;
const visibleDetails = detailState?.scope === fetchKeyPage ? detailState.details : {};
const keyCountLabel =
- isFiltering && searchFailed && !searching && shownKeys === 0
+ searchSettled && searchFailed && shownKeys === 0
? "Search failed"
: keyCountText(searching, isFiltering, shownKeys, total);
@@ -331,9 +332,10 @@ const KeyActivityPanel: React.FC<KeyActivityPanelProps> = ({
const firstPageFailed = failed && pageRows.length === 0;
const showNextPageRetry = failed && !firstPageFailed && !isFiltering;
const localOnly = searchTerm === null;
- const pageUnavailable = localOnly && pageRows.length === 0 && (loading || firstPageFailed);
+ const noLocalRows = localOnly && pageRows.length === 0;
+ const pageUnavailable = noLocalRows && (loading || firstPageFailed);
const listBody = pageUnavailable || (!isFiltering && pageRows.length === 0) ? emptyListBody : keyList;
- const noMatches = isFiltering && !searching && !pageUnavailable && shownKeys === 0;
+ const noMatches = searchSettled && !pageUnavailable && shownKeys === 0;
const showSearchErrorNote = !noMatches && searchFailed && !searching;
const searchRetryButton = (
<button type="button" className="font-medium text-foreground underline" onClick={retrySearch}>