fix(web): clear hasMore when removing channel states on DM close

removeChannelStates cleared messages and readStates but not hasMore.
When a closed DM was reopened with the same channel ID, loadMessages
saw the stale hasMore entry and skipped loading — showing an empty
chat. Now clears hasMore so messages reload on reopen.
This commit is contained in:
Jannis Braun
2026-04-01 13:19:41 +02:00
parent b1efeda1f3
commit 6de56edba0
+3 -1
View File
@@ -687,12 +687,14 @@ export const useChatStore = create<ChatState>((set, get) => ({
const newUnread = new Set(state.unreadChannels); const newUnread = new Set(state.unreadChannels);
const newReadStates = new Map(state.readStates); const newReadStates = new Map(state.readStates);
const newMessages = new Map(state.messages); const newMessages = new Map(state.messages);
const newHasMore = new Map(state.hasMore);
for (const channelId of channelIds) { for (const channelId of channelIds) {
newUnread.delete(channelId); newUnread.delete(channelId);
newReadStates.delete(channelId); newReadStates.delete(channelId);
newMessages.delete(channelId); newMessages.delete(channelId);
newHasMore.delete(channelId);
} }
return { unreadChannels: newUnread, readStates: newReadStates, messages: newMessages }; return { unreadChannels: newUnread, readStates: newReadStates, messages: newMessages, hasMore: newHasMore };
}); });
}, },