fix(proxy): resolve system proxy toggle stuck and state desync (#6614) (#6657)

* 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:
Tunglies
2026-03-27 15:40:03 +00:00
committed by GitHub
parent 607ef5a8a9
commit ca8e350694
3 changed files with 72 additions and 83 deletions
@@ -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 (