Skip to content

Commit

Permalink
Merge pull request #1120 from dm3-org/release-1.5-fix
Browse files Browse the repository at this point in the history
Release 1.5 fix : Fixed websocket contact not added bug
  • Loading branch information
AlexNi245 authored Jul 19, 2024
2 parents 4435bc5 + 49e9a34 commit 21c1f14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,17 +270,19 @@ export const useConversation = (config: DM3Configuration) => {
conversation: string,
updatedAt: number,
) => {
const newContactList = contacts.map((contact) => {
if (contact.contactDetails.account.ensName === conversation) {
return {
...contact,
updatedAt: updatedAt,
};
}
return contact;
setContacts((prev) => {
const newContactList = prev.map((contact) => {
if (contact.contactDetails.account.ensName === conversation) {
return {
...contact,
updatedAt: updatedAt,
};
}
return contact;
});
// Sort's the contact list in DESC order based on updatedAt property
return newContactList.sort((a, b) => b.updatedAt - a.updatedAt);
});
// Sort's the contact list in DESC order based on updatedAt property
setContacts(newContactList.sort((a, b) => b.updatedAt - a.updatedAt));
};

const _toggleHideContact = (_ensName: string, isHidden: boolean) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@ export const handleMessagesFromWebSocket = async (
contact,
messageModel.envelop.message.metadata.timestamp,
);

storeMessage(contact, messageModel);
};

0 comments on commit 21c1f14

Please sign in to comment.