diff --git a/ui/litellm-dashboard/src/components/view_logs/index.tsx b/ui/litellm-dashboard/src/components/view_logs/index.tsx index d55aa94bdac..10ba2dc3465 100644 --- a/ui/litellm-dashboard/src/components/view_logs/index.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/index.tsx @@ -102,7 +102,15 @@ export default function SpendLogsTable({ const queryClient = useQueryClient(); - const [isLiveTail, setIsLiveTail] = useState(true); // Default to true + const [isLiveTail, setIsLiveTail] = useState(() => { + const storedValue = sessionStorage.getItem("isLiveTail"); + // default to true if nothing is stored + return storedValue !== null ? JSON.parse(storedValue) : true; + }); + + useEffect(() => { + sessionStorage.setItem("isLiveTail", JSON.stringify(isLiveTail)); + }, [isLiveTail]); const [selectedTimeInterval, setSelectedTimeInterval] = useState<{ value: number; unit: string }>({ value: 24, @@ -244,7 +252,7 @@ export default function SpendLogsTable({ return response; }, enabled: !!accessToken && !!token && !!userRole && !!userID && activeTab === "request logs", - refetchInterval: isLiveTail ? 15000 : false, + refetchInterval: isLiveTail && currentPage === 1 ? 15000 : false, refetchIntervalInBackground: true, }); @@ -735,7 +743,7 @@ export default function SpendLogsTable({ - {isLiveTail && ( + {isLiveTail && currentPage === 1 && (