diff --git a/src/views/Conversations/Components/ConversationsList.jsx b/src/views/Conversations/Components/ConversationsList.jsx index a778263..15040e7 100644 --- a/src/views/Conversations/Components/ConversationsList.jsx +++ b/src/views/Conversations/Components/ConversationsList.jsx @@ -74,6 +74,7 @@ const Conversations = () => { return () => {}; }, [conversationsList, currentConversation]); + const [switchToC, setSwitchToC] = useState({}); const [shouldFetchCList, setShouldFetchCList] = useState(true); useEffect(() => { if (order_sn && shouldFetchCList && initialState) { @@ -116,12 +117,11 @@ const Conversations = () => { setCurrentConversation(item); }; - const [switchToC, setSwitchToC] = useState({}); const onSwitchConversation = (item) => { - if (item.coli_sn) { - navigate(`/order/chat/${item.coli_sn}`, { replace: true }); + if ( ! isEmpty(item.coli_sn)) { setSwitchToC(item); setShouldFetchCList(false); + navigate(`/order/chat/${item.coli_sn}`, { replace: true }); } else { navigate(`/order/chat`, { replace: true }); }