mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-20 19:12:09 +08:00
fix(proxy): unify node switching and connection cleanup (#8592)
Route frontend and tray node selections through the same backend flow for selection, persistence, state refresh, and connection cleanup. Read the group's previous selection before switching and preserve the original rule of closing only connections whose chains contain that selection. Run optional cleanup in the background and keep its failures separate from successful selection. Remove redundant frontend effects and unused IPC commands, and refresh the proxy view for every successful switch. Refs:32095daf90Refs:bea0dde074
This commit is contained in:
@@ -470,9 +470,6 @@ function NormalProxyGroups(props: { mode: string }) {
|
||||
}, [handleScroll])
|
||||
|
||||
const { select } = useProxySelection({
|
||||
onSuccess: () => {
|
||||
onProxies()
|
||||
},
|
||||
onError: (error) => {
|
||||
console.error('代理切换失败', error)
|
||||
onProxies()
|
||||
@@ -487,12 +484,12 @@ function NormalProxyGroups(props: { mode: string }) {
|
||||
if (group.name === globalGroupName) {
|
||||
pendingRevealRef.current =
|
||||
member.kind === 'group' ? member.ref.name : null
|
||||
// The selection refetches the view, so skip onHeadState's refetch.
|
||||
// The backend selection event refreshes the view.
|
||||
if (member.kind === 'group') {
|
||||
setHeadState(member.ref.name, { open: true })
|
||||
}
|
||||
}
|
||||
select(group.name, member.ref.name, group.now!, group.fixed!)
|
||||
select(group.name, member.ref.name, group.fixed!)
|
||||
},
|
||||
[globalGroupName, select, setHeadState],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user