fix(app): remove stale DM list gaps (#1583)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-13 21:10:41 +02:00
1 parent 614ee3a54b
commit 09ea748479
1 file changed
+6 -1
@@ -162,7 +162,12 @@ class DMChannelVisibilityController {
} }
private projectVisibleChannels({currentChannels, unreadIds}: ProjectVisibleDMChannelsRequest): Array<Channel> { private projectVisibleChannels({currentChannels, unreadIds}: ProjectVisibleDMChannelsRequest): Array<Channel> {
const leavingChannels = currentChannels.filter((channel) => !unreadIds.has(channel.id)); const visibleChannelIds = new Set(this.orderedUnreadChannels.map(getChannelId));
const leavingChannels = currentChannels.filter((channel) => {
if (unreadIds.has(channel.id) || visibleChannelIds.has(channel.id)) return false;
visibleChannelIds.add(channel.id);
return true;
});
for (const channel of leavingChannels) this.scheduleRemoval(channel.id); for (const channel of leavingChannels) this.scheduleRemoval(channel.id);
return [...this.orderedUnreadChannels, ...leavingChannels]; return [...this.orderedUnreadChannels, ...leavingChannels];
} }