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:
@@ -687,12 +687,14 @@ export const useChatStore = create<ChatState>((set, get) => ({
|
||||
const newUnread = new Set(state.unreadChannels);
|
||||
const newReadStates = new Map(state.readStates);
|
||||
const newMessages = new Map(state.messages);
|
||||
const newHasMore = new Map(state.hasMore);
|
||||
for (const channelId of channelIds) {
|
||||
newUnread.delete(channelId);
|
||||
newReadStates.delete(channelId);
|
||||
newMessages.delete(channelId);
|
||||
newHasMore.delete(channelId);
|
||||
}
|
||||
return { unreadChannels: newUnread, readStates: newReadStates, messages: newMessages };
|
||||
return { unreadChannels: newUnread, readStates: newReadStates, messages: newMessages, hasMore: newHasMore };
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user