From ddc2b35ac4c4e3fd7023869a1d766456f7309591 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Wed, 1 Jan 2025 23:00:49 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E5=89=8D=E7=AB=AF):=20=E4=B8=8D=E6=B8=85?= =?UTF-8?q?=E7=90=86=E6=9C=AA=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Conversations/Online/MessagesWrapper.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/Conversations/Online/MessagesWrapper.jsx b/src/views/Conversations/Online/MessagesWrapper.jsx index 04ede90..bf9be98 100644 --- a/src/views/Conversations/Online/MessagesWrapper.jsx +++ b/src/views/Conversations/Online/MessagesWrapper.jsx @@ -3,7 +3,7 @@ import useConversationStore from '@/stores/ConversationStore'; import { useShallow } from 'zustand/react/shallow'; import { Image, Modal, Button } from 'antd'; import MessagesList from './MessagesList'; -import { fetchCleanUnreadMsgCount, fetchMessages, MESSAGE_PAGE_SIZE } from '@/actions/ConversationActions'; +import { fetchCleanUnreadMsgCount, fetchMessages, MESSAGE_PAGE_SIZE, UNREAD_MARK } from '@/actions/ConversationActions'; import useAuthStore from '@/stores/AuthStore'; import { useVisibilityState } from '@/hooks/useVisibilityState'; import ConversationNewItem from './ConversationsNewItem'; @@ -92,7 +92,9 @@ const MessagesWrapper = ({ updateRead = true, forceGetMessages }) => { }, [activeMessages, currentConversationSN]); useEffect(() => { - if (updateRead === true && isVisible && currentConversation.opi_sn && activeMessages.length > 0) { + const cleanCurrent = currentConversation.unread_msg_count < UNREAD_MARK; // || currentConversation?.last_message?.actionId; // todo: 帖direction, msg_direction === 'outbound' ?? after send + // if (updateRead === true && isVisible && currentConversation.opi_sn && activeMessages.length > 0) { + if (updateRead === true && isVisible && currentConversation.opi_sn && cleanCurrent) { fetchCleanUnreadMsgCount({ opisn: currentConversation.opi_sn, conversationid: currentConversation.sn }); updateCurrentConversation({ unread_msg_count: 0 }); refreshTotalNotify();