perf: 转发邮件: 不推气泡到当前会话窗口; fix: 未读清零

dev/emitter
Lei OT 1 year ago
parent bb9e4956ec
commit 4074b0f023

@ -304,7 +304,12 @@ const conversationSlice = (set, get) => ({
// conversationsList: [...conversationsList],
}));
},
updateCurrentConversation: (conversation) => set((state) => ({ currentConversation: { ...state.currentConversation, ...conversation } })),
updateCurrentConversation: (conversation) => {
const { updateConversationItem, currentConversation } = get();
updateConversationItem({...currentConversation, ...conversation})
return set((state) => ({ currentConversation: { ...state.currentConversation, ...conversation } }))
},
updateConversationItem: (conversation) => {
const { conversationsList } = get();
const targetId = conversation.sn;
@ -443,8 +448,10 @@ const messageSlice = (set, get) => ({
"whatsapp_phone_number": message.type === 'email' ? null : message.from,
},
};
conversationsList.splice(targetIndex, 1);
conversationsList.unshift(newConversation);
if (String(targetId)!== '0') {
conversationsList.splice(targetIndex, 1);
conversationsList.unshift(newConversation);
}
// console.log('find in list, i:', targetIndex);
// console.log('find in list, chat updated and Top: \n', JSON.stringify(newConversation, null, 2));
// console.log('list updated : \n', JSON.stringify(conversationsList, null, 2));

@ -211,6 +211,7 @@ const EmailEditorPopup = ({ open, setOpen, fromEmail, fromUser, fromOrder, toEma
form.setFieldsValue(_formValues);
setInitialForm(_formValues);
} else if (action === 'forward') {
setStickToCid('0');
form.setFieldsValue(forwardValues);
setInitialForm(forwardValues);
} else if (action === 'edit') {

Loading…
Cancel
Save