mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-04-13 13:30:31 +08:00
Fixed race condition where button state and background color would desync during rapid toggles or slow backend responses. Root causes: - Button used actualState while background used configState - toggleSystemProxy returned immediately via setTimeout(0), releasing lock before backend operation completed - 100ms delay in updateProxyStatus caused visual flash Changes: - Unified state source: both button and background now use actualState - Made toggleSystemProxy truly async with proper await chain - Wrapped toggle function with useLockFn to serialize operations - Reduced state refresh delay from 100ms to 50ms - Fixed GuardState lock release timing for async operations - Added proper error rollback with state refresh on failure Resolves issue where proxy toggle button would show as off while background remained green, or vice versa.