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:
@@ -4,8 +4,7 @@ import { closeAllConnections } from 'tauri-plugin-mihomo-api'
|
||||
import { useVerge } from '@/hooks/use-verge'
|
||||
import { useClashConfigData, useSystemData } from '@/providers/app-data-context'
|
||||
import { getAutotemProxy } from '@/services/cmds'
|
||||
import { useQuery } from '@/services/query-client'
|
||||
import { queryClient } from '@/services/query-client'
|
||||
import { revalidateQueries, useQuery } from '@/services/query-client'
|
||||
|
||||
// 系统代理状态检测统一逻辑
|
||||
export const useSystemProxyState = () => {
|
||||
@@ -65,18 +64,12 @@ export const useSystemProxyState = () => {
|
||||
}
|
||||
} finally {
|
||||
busyRef.current = false
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: ['getSystemProxy'] }),
|
||||
queryClient.invalidateQueries({ queryKey: ['getAutotemProxy'] }),
|
||||
])
|
||||
await revalidateQueries([['getSystemProxy'], ['getAutotemProxy']])
|
||||
}
|
||||
}
|
||||
|
||||
const invalidateProxyState = () =>
|
||||
Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: ['getSystemProxy'] }),
|
||||
queryClient.invalidateQueries({ queryKey: ['getAutotemProxy'] }),
|
||||
])
|
||||
revalidateQueries([['getSystemProxy'], ['getAutotemProxy']])
|
||||
|
||||
return {
|
||||
indicator,
|
||||
|
||||
Reference in New Issue
Block a user