From 7f6450375b5bdf9308277910bc03aa5dd2fde462 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Mon, 16 Feb 2026 12:39:21 -0800 Subject: [PATCH] Fix duplicate ids in chat --- src/app/core/state.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/core/state.ts b/src/app/core/state.ts index 0b0eab4e..c5a4dcc2 100644 --- a/src/app/core/state.ts +++ b/src/app/core/state.ts @@ -450,7 +450,10 @@ export const chatsById = call(() => { const pubkeys = getChatPubkeysFromEvent(event) const id = makeChatId(pubkeys) const chat = chatsById.get(id) - const messages = sortBy(e => -e.created_at, append(event, chat?.messages || [])) + const messages = sortBy( + e => -e.created_at, + uniqBy(e => e.id, append(event, chat?.messages || [])), + ) const last_activity = Math.max(chat?.last_activity || 0, event.created_at) const updatedChat = addSearchText({id, pubkeys, messages, last_activity})