feature/IO-3000-messaging-sockets-migration2 -
-misc Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -32,8 +32,13 @@ function ChatConversationListComponent({ conversationList, selectedConversation,
|
||||
return () => clearInterval(interval); // Cleanup on unmount
|
||||
}, []);
|
||||
|
||||
// Memoize the sorted conversation list
|
||||
const sortedConversationList = React.useMemo(() => {
|
||||
return _.orderBy(conversationList, ["updated_at"], ["desc"]);
|
||||
}, [conversationList]);
|
||||
|
||||
const renderConversation = (index) => {
|
||||
const item = conversationList[index];
|
||||
const item = sortedConversationList[index];
|
||||
const cardContentRight = <TimeAgoFormatter>{item.updated_at}</TimeAgoFormatter>;
|
||||
const cardContentLeft =
|
||||
item.job_conversations.length > 0
|
||||
@@ -76,13 +81,10 @@ function ChatConversationListComponent({ conversationList, selectedConversation,
|
||||
);
|
||||
};
|
||||
|
||||
// CAN DO: Can go back into virtuoso for additional fetch
|
||||
// endReached={loadMoreConversations} // Calls loadMoreConversations when scrolled to the bottom
|
||||
|
||||
return (
|
||||
<div className="chat-list-container">
|
||||
<Virtuoso
|
||||
data={conversationList}
|
||||
data={sortedConversationList}
|
||||
itemContent={(index) => renderConversation(index)}
|
||||
style={{ height: "100%", width: "100%" }}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user