refactor: optimize swr data refresh paths

This commit is contained in:
Tunglies
2026-06-28 19:42:21 +08:00
parent e71e701fd0
commit b9da0875cd
16 changed files with 153 additions and 162 deletions
+8 -7
View File
@@ -14,8 +14,7 @@ import {
getRunningMode,
getSystemProxy,
} from '@/services/cmds'
import { useQuery } from '@/services/query-client'
import { queryClient } from '@/services/query-client'
import { revalidateQueries, useQuery } from '@/services/query-client'
import {
ClashConfigContext,
@@ -138,11 +137,13 @@ export const AppDataProvider = ({
}
lastProfileId = newProfileId
lastUpdateTime = now
void queryClient.invalidateQueries({ queryKey: ['getProfiles'] })
refreshProxy().catch(() => {})
refreshProxyProviders().catch(() => {})
refreshRules().catch(() => {})
refreshRuleProviders().catch(() => {})
void Promise.allSettled([
revalidateQueries([['getProfiles']]),
refreshProxy(),
refreshProxyProviders(),
refreshRules(),
refreshRuleProviders(),
])
}
const handleRefreshProxy = () => {