diff --git a/src/status_im/chat/models/message.cljs b/src/status_im/chat/models/message.cljs index ff84e5314a..4199e4cd0a 100644 --- a/src/status_im/chat/models/message.cljs +++ b/src/status_im/chat/models/message.cljs @@ -137,10 +137,11 @@ [{:ms 100 :dispatch [:chat/add-senders-to-chat-users (vals senders)]}]))})) (defn reduce-js-statuses [db ^js message-js] - (let [chat-id (.-localChatId message-js) + (let [chat-id (.-localChatId message-js) profile-initialized (get-in db [:pagination-info chat-id :messages-initialized?]) - timeline-message (timeline-message? db chat-id)] - (if (or profile-initialized timeline-message) + timeline-message (timeline-message? db chat-id) + old-message (get-in db [:messages chat-id (.-id message-js)])] + (if (and (or profile-initialized timeline-message) (nil? old-message)) (let [{:keys [message-id] :as message} (data-store.messages/<-rpc (types/js->clj message-js))] (cond-> db profile-initialized @@ -233,4 +234,4 @@ {:db (reduce (fn [acc current] (update-in acc [:messages (:chatId current)] remove-cleared-message (:clearedAt current))) db - cleared-histories)}) \ No newline at end of file + cleared-histories)})