From c8c189427221707832fa5257ece259321ee3bb52 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Fri, 9 Jan 2026 00:11:18 -0500 Subject: [PATCH] fix(ui): reduce excessive AGY quota API requests - Match staleTime to refetchInterval (60s) to prevent early refetches - Disable refetchOnWindowFocus to prevent tab switch triggers - Disable refetchOnMount to prevent HMR/navigation remount triggers --- ui/src/hooks/use-cliproxy-stats.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/src/hooks/use-cliproxy-stats.ts b/ui/src/hooks/use-cliproxy-stats.ts index cc9cf222..3b9d43d0 100644 --- a/ui/src/hooks/use-cliproxy-stats.ts +++ b/ui/src/hooks/use-cliproxy-stats.ts @@ -225,8 +225,10 @@ export function useAccountQuota(provider: string, accountId: string, enabled = t queryKey: ['account-quota', provider, accountId], queryFn: () => fetchAccountQuota(provider, accountId), enabled: enabled && provider === 'agy' && !!accountId, - staleTime: 30000, // Consider stale after 30s (tokens can refresh anytime) + staleTime: 60000, // Match refetchInterval to prevent early refetching refetchInterval: 60000, // Refresh every 1 minute + refetchOnWindowFocus: false, // Don't refetch on tab switch + refetchOnMount: false, // Don't refetch on component remount (AuthMonitor re-renders) retry: 1, }); }