From f929ebc184013c409855d19059e82609e1cbc2c3 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 26 Apr 2026 16:13:58 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(im):=20=E5=A2=9E=E5=8A=A0=20co?= =?UTF-8?q?nversationStore.ts=20=E6=9C=AA=E6=9D=A5=E7=9A=84=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20todo=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/im/home/store/conversationStore.ts | 5 ++++- src/views/im/home/store/websocketStore.ts | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/views/im/home/store/conversationStore.ts b/src/views/im/home/store/conversationStore.ts index f810386c0..301a092d9 100644 --- a/src/views/im/home/store/conversationStore.ts +++ b/src/views/im/home/store/conversationStore.ts @@ -20,6 +20,9 @@ import type { Conversation, ConversationStoreMeta, Message } from '../types' const AT_ALL_FLAG = -1 // @全体成员 的特殊 userId 标识:atUserIds 中包含 -1 表示 @all +// TODO @芋艿:单个 conversation 的消息过多后,可能存储起来会很慢,后续看看怎么优化。 +// TODO @芋艿:首次拉取消息时,如果消息过多,可能导致渲染卡顿。(1% 场景) + /** 获取当前登录用户编号 */ function getCurrentUserId(): number { const { wsCache } = useCache() @@ -476,7 +479,7 @@ export const useConversationStore = defineStore('imConversationStore', { this.saveConversations(conversation) }, - /** 撤回消息:解析撤回信号 content(`{"messageId": xxx}`),找到原消息翻成 RECALL 态 + 刷新会话摘要 */ + /** 撤回消息:解析撤回信号 content(`{"messageId": xxx}`),找到原消息更新为 RECALL 态 + 刷新会话摘要 */ recallMessage( conversationType: number, targetId: number, diff --git a/src/views/im/home/store/websocketStore.ts b/src/views/im/home/store/websocketStore.ts index e30ad386e..8ff3c69be 100644 --- a/src/views/im/home/store/websocketStore.ts +++ b/src/views/im/home/store/websocketStore.ts @@ -286,7 +286,7 @@ export const useImWebSocketStore = defineStore('imWebSocketStore', { } // 3. 后端撤回:下发一条 RECALL 消息,content 为 `{"messageId": xxx}`(对齐 ImMessageTypeEnum.RECALL → RecallMessage) - // 这里拦截下来改走 recallMessage(把原消息翻转为 RECALL 态),不让它作为新消息进列表 + // 这里拦截下来改走 recallMessage(把原消息更新为 RECALL 态),不让它作为新消息进列表 if (websocketMessage.type === ImMessageType.RECALL) { conversationStore.recallMessage( ImConversationType.PRIVATE, @@ -395,7 +395,7 @@ export const useImWebSocketStore = defineStore('imWebSocketStore', { const senderNickName = senderMember?.displayUserName || senderMember?.nickname || '' // 3. 后端撤回:下发一条 RECALL 消息,content 为 `{"messageId": xxx}` - // 这里拦截下来改走 recallMessage(把原消息翻转为 RECALL 态) + // 这里拦截下来改走 recallMessage(把原消息更新为 RECALL 态) if (websocketMessage.type === ImMessageType.RECALL) { conversationStore.recallMessage( ImConversationType.GROUP,