Skip to content

Commit

Permalink
fix: 修复自己发送的消息撤回未更新
Browse files Browse the repository at this point in the history
  • Loading branch information
Evansy authored Sep 28, 2023
1 parent f208db9 commit 8a4ceb8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/stores/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ export const useChatStore = defineStore('chat', () => {
// 如果被撤回的消息是消息发送者撤回,正常显示
message.message.body = `"${cacheUser.name}"撤回了一条消息` // 后期根据本地用户数据修改
}
// 上面直接修改对象值,响应式未触发,下面手动触发一下
currentMessageMap.value?.delete(msgId)
// 加定时器是为了把让 删除和复制在 分开的循环队列里面做,否则不会触发更新效果
setTimeout(() => {
currentMessageMap.value?.set(msgId, message)
}, 0)
}
}
// 更新与这条撤回消息有关的消息
Expand Down

0 comments on commit 8a4ceb8

Please sign in to comment.