mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-08 19:22:44 +08:00
refactor: optimize swr data refresh paths
This commit is contained in:
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user