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): Fetch button ignores active filters on Request Logs page (#25788)

Rick4b2fd870ca3d
diff --git a/ui/litellm-dashboard/src/components/view_logs/index.tsx b/ui/litellm-dashboard/src/components/view_logs/index.tsx
index 97e24cb516a..8205c0b4b86 100644
--- a/ui/litellm-dashboard/src/components/view_logs/index.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/index.tsx
@@ -243,6 +243,7 @@ export default function SpendLogsTable({
allTeams,
handleFilterChange,
handleFilterReset: handleFilterResetFromHook,
+ refetchWithFilters,
} = useLogFilterLogic({
logs: logsData,
accessToken,
@@ -363,7 +364,14 @@ export default function SpendLogsTable({
// Add this function to handle manual refresh
const handleRefresh = () => {
- logs.refetch();
+ if (hasBackendFilters) {
+ // When backend filters (e.g. Key Alias) are active the main TanStack Query
+ // is disabled and its params do not include filter values like key_alias.
+ // Route through the filter-aware refetch so all active filters are preserved.
+ refetchWithFilters();
+ } else {
+ logs.refetch();
+ }
};
const handleRowClick = (log: LogEntry) => {
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.tsx
index 8c88de49d0d..efe0eca3da9 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
@@ -299,6 +299,20 @@ export function useLogFilterLogic({
setCurrentPage(1);
};
+ // Expose a filter-aware refetch so callers (e.g. the manual Fetch button) can
+ // refresh results while keeping all active backend filters intact. The plain
+ // `logs.refetch()` in the parent only re-runs the main TanStack Query, which
+ // does not carry key_alias or other backend-only filter params.
+ const refetchWithFilters = useCallback(
+ (page = currentPage) => {
+ if (hasBackendFilters && accessToken) {
+ debouncedSearch.cancel();
+ performSearch(filters, page);
+ }
+ },
+ [hasBackendFilters, accessToken, filters, currentPage, performSearch, debouncedSearch],
+ );
+
return {
filters,
filteredLogs,
@@ -306,5 +320,6 @@ export function useLogFilterLogic({
allTeams,
handleFilterChange,
handleFilterReset,
+ refetchWithFilters,
};
}