From 874f9da12c8c383c3d7c9e7954c9517d67246e80 Mon Sep 17 00:00:00 2001 From: benya Date: Sun, 8 Mar 2026 02:52:26 +0300 Subject: [PATCH] fix(realtime): resync active chat messages on websocket reconnect - on ws reconnect, reload chats and active chat history - reduce status/history drift after transient disconnects --- web/src/hooks/useRealtime.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/hooks/useRealtime.ts b/web/src/hooks/useRealtime.ts index 56fac91..1382ec4 100644 --- a/web/src/hooks/useRealtime.ts +++ b/web/src/hooks/useRealtime.ts @@ -62,7 +62,11 @@ export function useRealtime() { ws.close(); } }, 15000); - void useChatStore.getState().loadChats(); + const store = useChatStore.getState(); + void store.loadChats(); + if (store.activeChatId) { + void store.loadMessages(store.activeChatId); + } }; ws.onmessage = (messageEvent) => {