mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 00:14:15 +00:00
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
This commit is contained in:
1 parent
7c5f36580a
commit
c8c1894272
1 file changed
+3
-1
@@ -225,8 +225,10 @@ export function useAccountQuota(provider: string, accountId: string, enabled = t
|
|||||||
queryKey: ['account-quota', provider, accountId],
|
queryKey: ['account-quota', provider, accountId],
|
||||||
queryFn: () => fetchAccountQuota(provider, accountId),
|
queryFn: () => fetchAccountQuota(provider, accountId),
|
||||||
enabled: enabled && provider === 'agy' && !!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
|
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,
|
retry: 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user