From 64340226c536e61ff7acca66a73fdbf15f59085c Mon Sep 17 00:00:00 2001 From: Ceder Date: Fri, 5 Jun 2026 20:18:07 +0200 Subject: [PATCH] fix(ui): derive session total from accumulated rows when backend omits it Compute the session total after all pages are fetched, falling back to the accumulated row count rather than the first page's. Guards the truncation note against a backend response that omits total but spans multiple pages. --- .../view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx index af21765d685..f1aff8cbce3 100644 --- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailsDrawer.tsx @@ -129,7 +129,6 @@ export function LogDetailsDrawer({ // than one page of logs are shown in full (capped for safety). const firstPage = await sessionSpendLogsCall(accessToken, sessionId, 1, SESSION_PAGE_SIZE); let rows: LogEntry[] = firstPage.data || firstPage || []; - const total: number = firstPage.total ?? rows.length; const pagesToFetch = Math.min(firstPage.total_pages ?? 1, MAX_SESSION_PAGES); if (pagesToFetch > 1) { @@ -149,6 +148,10 @@ export function LogDetailsDrawer({ } } + // Fall back to the accumulated row count (not just the first page) when the + // backend omits total, so the truncation note reflects what was fetched. + const total: number = firstPage.total ?? rows.length; + const logs = rows .map((row) => ({ ...row,