|
|
|
@ -334,6 +334,7 @@ const messageSlice = (set, get) => ({
|
|
|
|
|
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));
|
|
|
|
|
const isCurrent = Number(targetId) === Number(currentConversation.sn);
|
|
|
|
|
const updatedCurrent = isCurrent
|
|
|
|
|
? {
|
|
|
|
@ -342,9 +343,6 @@ const messageSlice = (set, get) => ({
|
|
|
|
|
conversation_expiretime: dayjs(message.date).add(24, 'hours').format(DATETIME_FORMAT),
|
|
|
|
|
}
|
|
|
|
|
: {...currentConversation};
|
|
|
|
|
// const currentI = conversationsList.findIndex((ele) => String(ele.sn) === String(currentConversation.sn));
|
|
|
|
|
console.log('message in chat', JSON.stringify(message, null, 2), 'currentConversation', JSON.stringify(currentConversation, null, 2));
|
|
|
|
|
console.log('is current and update', isCurrent, JSON.stringify(updatedCurrent, null, 2));
|
|
|
|
|
return set({
|
|
|
|
|
currentConversation: updatedCurrent,
|
|
|
|
|
conversationsList: [...conversationsList],
|
|
|
|
|