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).
This commit is contained in:
LTbinglingfeng
2026-05-25 23:51:49 +08:00
Unverified
parent 0992b8b4fb
commit d2ab416f6c
@@ -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(() => {});