fix: 从store读取当前会话信息

hotfix/new-conversation
Lei OT 1 year ago
parent 01b8c2770e
commit 7f50aeb0d3

@ -206,6 +206,7 @@ const conversationSlice = (set, get) => ({
const { conversationsList } = get(); const { conversationsList } = get();
const targetId = conversation.sn; const targetId = conversation.sn;
const targetIndex = conversationsList.findIndex((ele) => String(ele.sn) === String(targetId)); const targetIndex = conversationsList.findIndex((ele) => String(ele.sn) === String(targetId));
const targetItemFromList = conversationsList.find((ele) => String(ele.sn) === String(targetId));
targetIndex !== -1 targetIndex !== -1
? conversationsList.splice(targetIndex, 1, { ? conversationsList.splice(targetIndex, 1, {
...conversationsList[targetIndex], ...conversationsList[targetIndex],
@ -215,7 +216,7 @@ const conversationSlice = (set, get) => ({
return set((state) => ({ return set((state) => ({
totalNotify: state.totalNotify - (conversation.unread_msg_count || 0), totalNotify: state.totalNotify - (conversation.unread_msg_count || 0),
currentConversation: conversation, currentConversation: Object.assign({}, conversation, targetItemFromList),
referenceMsg: {}, referenceMsg: {},
conversationsList: [...conversationsList], conversationsList: [...conversationsList],
})); }));

Loading…
Cancel
Save