refactor(proxy): clarify automatic proxy query naming

This commit is contained in:
Tunglies
2026-10-08 02:22:58 +08:00
parent 17ee7f348c
commit 1987f105d4
3 changed files with 8 additions and 12 deletions
+6 -6
View File
@@ -5,7 +5,7 @@ import { useDisplayedMixedPort } from '@/hooks/use-displayed-mixed-port'
import { useVerge } from '@/hooks/use-verge'
import { useSystemData } from '@/providers/app-data-context'
import {
getAutotemProxy,
getAutoProxy,
getEmbeddedServerPort,
patchVergeConfig,
} from '@/services/cmds'
@@ -21,8 +21,8 @@ export const useSystemProxyState = () => {
const { sysproxy } = useSystemData()
const displayedMixedPort = useDisplayedMixedPort()
const { data: autoproxy } = useQuery({
queryKey: ['getAutotemProxy'],
queryFn: getAutotemProxy,
queryKey: ['getAutoProxy'],
queryFn: getAutoProxy,
refetchOnWindowFocus: true,
refetchOnReconnect: true,
})
@@ -99,7 +99,7 @@ export const useSystemProxyState = () => {
}
// Kept separate so an unreadable config cannot discard OS state that did read.
try {
await revalidateQueries([['getSystemProxy'], ['getAutotemProxy']])
await revalidateQueries([['getSystemProxy'], ['getAutoProxy']])
} catch (error) {
console.warn(
'[system-proxy] rereading the OS proxy after a toggle failed:',
@@ -109,14 +109,14 @@ export const useSystemProxyState = () => {
// rather than stay live from a stale cache.
await Promise.all([
removeCacheData(['getSystemProxy']),
removeCacheData(['getAutotemProxy']),
removeCacheData(['getAutoProxy']),
])
}
}
}
const invalidateProxyState = () =>
revalidateQueries([['getSystemProxy'], ['getAutotemProxy']])
revalidateQueries([['getSystemProxy'], ['getAutoProxy']])
return {
indicator,
+1 -5
View File
@@ -72,11 +72,7 @@ export const createEventBus = (deps: BusHandlerDeps) => {
'getRuleProviders',
]),
'verge://refresh-verge-config': () =>
deps.revalidateKeys([
'getVergeConfig',
'getSystemProxy',
'getAutotemProxy',
]),
deps.revalidateKeys(['getVergeConfig', 'getSystemProxy', 'getAutoProxy']),
'verge://refresh-profiles': () => deps.revalidateKeys(['getProfiles']),
'verge://refresh-proxy-config': handleRefreshProxyConfig,
'verge://notice-message': (payload) => deps.handleNotice(payload),
+1 -1
View File
@@ -256,7 +256,7 @@ export async function getSystemProxy() {
return commands.getSysProxy()
}
export async function getAutotemProxy() {
export async function getAutoProxy() {
try {
debugLog('[API] 开始调用 get_auto_proxy')
const result = await commands.getAutoProxy()