From d2ab416f6cf7f192e2deb88bb939497b1c210f2b Mon Sep 17 00:00:00 2001 From: LTbinglingfeng Date: Mon, 25 May 2026 23:51:49 +0800 Subject: [PATCH] fix(providers): fetch recent requests on mount The new workbench only wired refreshRecentRequests into the manual refresh button; the hook itself just set an interval (240s). As a result the status bar showed empty/zero until the first poll. Load on mount when enabled (cache hit avoids a network round-trip). --- .../providers/hooks/useProviderRecentRequests.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/providers/hooks/useProviderRecentRequests.ts b/src/components/providers/hooks/useProviderRecentRequests.ts index 6b803f3..971a970 100644 --- a/src/components/providers/hooks/useProviderRecentRequests.ts +++ b/src/components/providers/hooks/useProviderRecentRequests.ts @@ -110,8 +110,12 @@ export function useProviderRecentRequests(options: UseProviderRecentRequestsOpti ); useEffect(() => { - setUsageByProvider(enabled ? cachedUsageByProvider : EMPTY_USAGE_BY_PROVIDER); - }, [enabled]); + if (!enabled) { + setUsageByProvider(EMPTY_USAGE_BY_PROVIDER); + return; + } + void loadRecentRequests().catch(() => {}); + }, [enabled, loadRecentRequests]); useInterval(() => { void refreshRecentRequests().catch(() => {});