mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-25 21:22:20 +08:00
* fix(proxy): resolve system proxy toggle stuck and state desync (#6614) Backend: replace hand-rolled AtomicBool lock in update_sysproxy() with tokio::sync::Mutex so concurrent calls wait instead of being silently dropped, ensuring the latest config is always applied. Move blocking OS calls (networksetup on macOS) to spawn_blocking so they no longer stall the tokio worker thread pool. Frontend: release SwitchRow pendingRef in .finally() so the UI always re-syncs with the actual OS proxy state, and rollback checked on error. Closes #6614 * fix(changelog): add note for macOS proxy toggle freeze issue
This commit is contained in:
@@ -67,10 +67,14 @@ const SwitchRow = ({
|
||||
const handleChange = (_: React.ChangeEvent, value: boolean) => {
|
||||
pendingRef.current = true
|
||||
setChecked(value)
|
||||
onToggle(value).catch((err: any) => {
|
||||
pendingRef.current = false
|
||||
onError?.(err)
|
||||
})
|
||||
onToggle(value)
|
||||
.catch((err: any) => {
|
||||
setChecked(active)
|
||||
onError?.(err)
|
||||
})
|
||||
.finally(() => {
|
||||
pendingRef.current = false
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user