From 7ccc3337579a27962d03add971af4ade1132d7af Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Wed, 6 Oct 2021 14:14:40 +1100 Subject: [PATCH] Only process message with a clock It may be better to use the timestamp on Waku Message than the Chat Message clock: https://github.com/status-im/dappconnect-chat-sdk/issues/5#issuecomment-935322419 --- packages/react-chat/src/hooks/useMessenger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-chat/src/hooks/useMessenger.ts b/packages/react-chat/src/hooks/useMessenger.ts index f6c17b08..82d4d08a 100644 --- a/packages/react-chat/src/hooks/useMessenger.ts +++ b/packages/react-chat/src/hooks/useMessenger.ts @@ -74,7 +74,7 @@ export function useMessenger(chatId: string, chatIdList: string[]) { const addNewMessage = useCallback( (msg: ApplicationMetadataMessage, id: string) => { - if (msg.signer && msg.chatMessage?.text) { + if (msg.signer && msg.chatMessage?.text && msg.chatMessage.clock) { const content = msg.chatMessage.text; const date = new Date(msg.chatMessage.clock); addNewMessageRaw(msg.signer, content, date, id);