From 1c4ddfb2ce57f25646ac480ab4b95698baf32205 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 16 May 2026 12:28:30 +0000 Subject: [PATCH] fix(chats): dedupe public channels in known list by channel id ChatroomListKnownFeedFilter.feed() iterated account.publicChatList.flow, a Set. ChannelTag uses identity equality (it's not a data class) and the set is built from raw tag parsing, so a channel list that names the same channel id twice (e.g., the same channel appearing in the public section and the encrypted private section, or repeated with different relay hints) produces multiple ChannelTag entries for the same channel. Each one resolved to the same newest Note via getOrCreatePublicChatChannel(it.eventId), so the feed contained the same Note twice and the chat list LazyColumn crashed with "Key PublicChannelLazyKey(channelId=...) was already used". Use the sibling flowSet (Set, already deduped by event id), which is the same source filterRelevantPublicMessages reads from. --- .../loggedIn/chats/rooms/dal/ChatroomListKnownFeedFilter.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/dal/ChatroomListKnownFeedFilter.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/dal/ChatroomListKnownFeedFilter.kt index 20699882cb..cba0f06476 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/dal/ChatroomListKnownFeedFilter.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/rooms/dal/ChatroomListKnownFeedFilter.kt @@ -55,10 +55,10 @@ class ChatroomListKnownFeedFilter( val publicChannels = account - .publicChatList.flow.value - .mapNotNull { it -> + .publicChatList.flowSet.value + .mapNotNull { channelId -> LocalCache - .getOrCreatePublicChatChannel(it.eventId) + .getOrCreatePublicChatChannel(channelId) .notes .filter { _, it -> account.isAcceptable(it) && it.event != null } .sortedWith(DefaultFeedOrder)