From 1c806be94f0c8dae906dfe9dae1a5fdab9a4ec0b Mon Sep 17 00:00:00 2001
From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com>
Date: Mon, 16 Mar 2026 22:34:21 +0100
Subject: [PATCH] fix: clear message cache on reconnect to prevent stale scroll
position
After a server restart, navigating to a previously-visited channel showed
messages at a stale middle position instead of scrolling to the bottom.
The in-memory message cache survived the reconnect, so loadMessages()
bailed (cache hit) and the scroll-to-bottom logic never fired.
Now the ready handler clears the messages and hasMore maps for all
channels belonging to the reconnecting origin (including DMs for home).
The currently open channel is force-reloaded immediately; other channels
get fresh-fetched on next visit, triggering proper scroll-to-bottom.
Also fixes voice channel settings gear icon placement to match text
channels (flex-1 pushes icon to right edge).
---
.../web/src/components/voice/VoiceChannel.tsx | 6 ++--
packages/web/src/hooks/useWebSocket.ts | 30 +++++++++++++++----
2 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/packages/web/src/components/voice/VoiceChannel.tsx b/packages/web/src/components/voice/VoiceChannel.tsx
index c8837eed..6d40d936 100644
--- a/packages/web/src/components/voice/VoiceChannel.tsx
+++ b/packages/web/src/components/voice/VoiceChannel.tsx
@@ -138,8 +138,8 @@ export function VoiceChannel({ channelId, channelName, onClick, locked, canManag
)}
- {channelName}
- {canManage && onSettingsClick && (
+ {channelName}
+ {canManage && (