From 1e5bab1cb63c7cfe1aba5add8d4b23aef1980b6d Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 15 Dec 2025 23:12:26 +0800 Subject: [PATCH] fix(proxy): invalidate health cache when proxy stops The previous fix (e081c75) only cleared the database records but didn't invalidate the React Query cache. This caused stale health badges to appear when restarting the proxy. Now invalidates all providerHealth queries on stop, ensuring the frontend fetches fresh data from the database. --- src/hooks/useProxyStatus.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hooks/useProxyStatus.ts b/src/hooks/useProxyStatus.ts index 12d7ac6a0..b0ba91830 100644 --- a/src/hooks/useProxyStatus.ts +++ b/src/hooks/useProxyStatus.ts @@ -65,6 +65,8 @@ export function useProxyStatus() { ); queryClient.invalidateQueries({ queryKey: ["proxyStatus"] }); queryClient.invalidateQueries({ queryKey: ["proxyTakeoverActive"] }); + // 清除所有供应商健康状态缓存(后端已清空数据库记录) + queryClient.invalidateQueries({ queryKey: ["providerHealth"] }); }, onError: (error: Error) => { const detail = extractErrorMessage(error) || "未知错误";