perf(前端): 不清理未读

dev/supplier-email-drawer
Lei OT 9 months ago
parent 4db2172795
commit ddc2b35ac4

@ -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();

Loading…
Cancel
Save