mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-08 11:02:08 +08:00
refactor: frontend (#7097)
* refactor: remove unused window show/hide event listeners * refactor: deduplicate profile-changed event handling * refactor: remove unused setupCloseListener from use-listen * refactor: remove unused removeAllListeners from use-listen * fix(backend): dedupe profile changed notification on import * fix: avoid duplicate timer update completed event * refactor(frontend): simplify proxy switch fallback path
This commit is contained in:
@@ -104,29 +104,14 @@ export const useProxySelection = (options: ProxySelectionOptions = {}) => {
|
||||
config.autoCloseConnection &&
|
||||
previousProxy
|
||||
) {
|
||||
setTimeout(() => cleanupConnections(previousProxy), 0)
|
||||
void cleanupConnections(previousProxy)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`[ProxySelection] 代理切换失败: ${groupName} -> ${proxyName}`,
|
||||
error,
|
||||
)
|
||||
|
||||
try {
|
||||
await selectNodeForGroup(groupName, proxyName)
|
||||
onSuccess?.()
|
||||
syncTraySelection()
|
||||
persistSelection(groupName, proxyName, skipConfigSave)
|
||||
debugLog(
|
||||
`[ProxySelection] 代理切换回退成功: ${groupName} -> ${proxyName}`,
|
||||
)
|
||||
} catch (fallbackError) {
|
||||
console.error(
|
||||
`[ProxySelection] 代理切换回退也失败: ${groupName} -> ${proxyName}`,
|
||||
fallbackError,
|
||||
)
|
||||
onError?.(fallbackError)
|
||||
}
|
||||
onError?.(error)
|
||||
}
|
||||
},
|
||||
[config, onError, onSuccess, persistSelection, syncTraySelection],
|
||||
|
||||
Reference in New Issue
Block a user