Dedupe contacts/sidebar by key not name

This commit is contained in:
Jack Kingsman
2026-02-14 21:22:33 -08:00
parent 6e3cf28577
commit 3756579f9d
4 changed files with 88 additions and 39 deletions
+3 -2
View File
@@ -140,11 +140,12 @@ export function Sidebar({
[lastMessageTimes]
);
// Deduplicate channels by name, keeping the first (lowest index)
// Deduplicate channels by key only.
// Channel names are not unique; distinct keys must remain visible.
const uniqueChannels = useMemo(
() =>
channels.reduce<Channel[]>((acc, channel) => {
if (!acc.some((c) => c.name === channel.name)) {
if (!acc.some((c) => c.key === channel.key)) {
acc.push(channel);
}
return acc;