From 571298659ca7f9222d4dbd92c51b97c34af178f8 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 14 Mar 2024 01:07:58 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=9B=B4=E6=96=B0=E4=BC=9A=E8=AF=9D?= =?UTF-8?q?=E7=9A=84=E4=B8=8B=E4=B8=80=E9=A1=B5=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Conversations/Components/ConversationsList.jsx | 7 +++---- src/views/Conversations/Components/MessagesWrapper.jsx | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/views/Conversations/Components/ConversationsList.jsx b/src/views/Conversations/Components/ConversationsList.jsx index 7037a12..7e1af6d 100644 --- a/src/views/Conversations/Components/ConversationsList.jsx +++ b/src/views/Conversations/Components/ConversationsList.jsx @@ -1,9 +1,8 @@ import { useEffect, useState, useRef } from 'react'; import { useParams, useNavigate, useLocation } from 'react-router-dom'; -import { Button, Dropdown, Input } from 'antd'; -import { MoreOutlined } from '@ant-design/icons'; -import { fetchOrderConversationsList, fetchConversationItemClose, fetchMessages, MESSAGE_PAGE_SIZE, fetchCleanUnreadMsgCount } from '@/actions/ConversationActions'; -import { ChatList, ChatItem } from 'react-chat-elements'; +import { Dropdown, Input } from 'antd'; +import { fetchOrderConversationsList, fetchConversationItemClose, fetchMessages, MESSAGE_PAGE_SIZE, } from '@/actions/ConversationActions'; +import { ChatItem } from 'react-chat-elements'; import { isEmpty } from '@/utils/utils'; import useConversationStore from '@/stores/ConversationStore'; import useAuthStore from '@/stores/AuthStore'; diff --git a/src/views/Conversations/Components/MessagesWrapper.jsx b/src/views/Conversations/Components/MessagesWrapper.jsx index 529a51b..815d64b 100644 --- a/src/views/Conversations/Components/MessagesWrapper.jsx +++ b/src/views/Conversations/Components/MessagesWrapper.jsx @@ -22,6 +22,9 @@ const MessagesWrapper = () => { if (currentConversation.opi_sn && currentConversation.whatsapp_phone_number && activeMessages.length > 0) { fetchCleanUnreadMsgCount({ opisn: currentConversation.opi_sn, whatsappid: currentConversation.whatsapp_phone_number }); } + const thisLastTime = activeMessages.length > 0 ? activeMessages[0].orgmsgtime : ''; + const loadNextPage = !(activeMessages.length === 0 || activeMessages.length < MESSAGE_PAGE_SIZE); + updateCurrentConversation({ lasttime: thisLastTime, loadNextPage }); return () => {}; }, [activeMessages, currentConversation.sn]);