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 - Logs: disable main query while backend filters are active
yuneng-jiangf5caa34ebe7a
diff --git a/ui/litellm-dashboard/src/components/view_logs/index.tsx b/ui/litellm-dashboard/src/components/view_logs/index.tsxindex 83e889d2d6c..0cdca512e94 100644--- a/ui/litellm-dashboard/src/components/view_logs/index.tsx+++ b/ui/litellm-dashboard/src/components/view_logs/index.tsx@@ -91,6 +91,11 @@ export default function SpendLogsTable({const [sortBy, setSortBy] = useState<LogsSortField>("startTime");const [sortOrder, setSortOrder] = useState<"asc" | "desc">("desc");+ // Tracks whether any filter that uses performSearch (backend) is active.+ // Used to disable the main query so it doesn't fire redundant unfiltered requests+ // when time range / sort / page changes while a backend filter is in effect.+ const [isMainQueryEnabled, setIsMainQueryEnabled] = useState(true);+const queryClient = useQueryClient();const [isLiveTail, setIsLiveTail] = useState<boolean>(() => {@@ -212,7 +217,7 @@ export default function SpendLogsTable({return response;},- enabled: !!accessToken && !!token && !!userRole && !!userID && activeTab === "request logs",+ enabled: !!accessToken && !!token && !!userRole && !!userID && activeTab === "request logs" && isMainQueryEnabled,refetchInterval: isLiveTail && currentPage === 1 ? 15000 : false,placeholderData: keepPreviousData,refetchIntervalInBackground: true,@@ -235,6 +240,7 @@ export default function SpendLogsTable({const {filters,filteredLogs,+ hasBackendFilters,allTeams: hookAllTeams,allKeyAliases,handleFilterChange,@@ -264,6 +270,12 @@ export default function SpendLogsTable({setCurrentPage(1);}, [handleFilterResetFromHook]);+ // Disable the main query whenever backend filters are active so it doesn't fire+ // redundant unfiltered requests when time range / sort / page changes.+ useEffect(() => {+ setIsMainQueryEnabled(!hasBackendFilters);+ }, [hasBackendFilters]);+// Sync filter state into the individual selectedX state variables used by the main queryuseEffect(() => {if (!accessToken) return;@@ -673,7 +685,7 @@ export default function SpendLogsTable({</div></div></div>- {isLiveTail && currentPage === 1 && (+ {isLiveTail && currentPage === 1 && isMainQueryEnabled && (<div className="mb-4 px-4 py-2 bg-green-50 border border-greem-200 rounded-md flex items-center justify-between"><div className="flex items-center gap-2"><span className="text-sm text-green-700">Auto-refreshing every 15 seconds</span>diff --git a/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx b/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsxindex 0701d38af46..097519d2f35 100644--- a/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx+++ b/ui/litellm-dashboard/src/components/view_logs/log_filter_logic.tsx@@ -309,6 +309,7 @@ export function useLogFilterLogic({return {filters,filteredLogs,+ hasBackendFilters,allKeyAliases,allTeams,handleFilterChange,