fix: throttle WebSocket subscriptions to prevent UI freeze on profile switch (#6683) (#6686)

Add leading-edge throttle to useMihomoWsSubscription, reduce SWR retry
aggressiveness, and increase WebSocket reconnect delay to prevent event
storms when switching profiles under poor network conditions.
This commit is contained in:
Tunglies
2026-04-02 13:22:30 +00:00
committed by GitHub
parent 3714f0c4c8
commit 824bcc77eb
5 changed files with 61 additions and 12 deletions
+1
View File
@@ -15,6 +15,7 @@ export const useMemoryData = () => {
buildSubscriptKey: (date) => `getClashMemory-${date}`,
fallbackData: FALLBACK_MEMORY_USAGE,
connect: () => MihomoWebSocket.connect_memory(),
throttleMs: 500,
setupHandlers: ({ next, scheduleReconnect }) => ({
handleMessage: (data) => {
if (data.startsWith('Websocket error')) {