diff --git a/web/src/stores/message.ts b/web/src/stores/message.ts index 5d5a68c..6d0d8f5 100644 --- a/web/src/stores/message.ts +++ b/web/src/stores/message.ts @@ -92,19 +92,12 @@ export const useMessageStore = create((set) => ({ sendMessage: async (channelId, content, replyTo) => { const body: { content: string; reply_to?: string } = { content }; if (replyTo) body.reply_to = replyTo; + // ponytail: don't append here — WS MESSAGE_CREATE broadcast is the single source of truth. + // Appending in both places caused double messages when the WS event arrived before the HTTP response. const message = await api.post( `/channels/${channelId}/messages`, body, ); - set((state) => { - const list = state.messagesByChannel[channelId] || []; - return { - messagesByChannel: { - ...state.messagesByChannel, - [channelId]: [...list, message], - }, - }; - }); return message; },