From 5d41cdda0c48a67a96171a8853c1af15d0e7c829 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Thu, 31 May 2018 11:57:09 +0300 Subject: [PATCH] [#4551] fix error on fetching history for removed chat --- src/status_im/transport/inbox.cljs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/status_im/transport/inbox.cljs b/src/status_im/transport/inbox.cljs index bc339f6d6d..94e53c7fef 100644 --- a/src/status_im/transport/inbox.cljs +++ b/src/status_im/transport/inbox.cljs @@ -371,7 +371,10 @@ (handlers/register-handler-fx :inbox/check-fetching (fn [{:keys [db now] :as cofx} [_ last-request chat-id]] - (when (:inbox/fetching? db) + (when (and (:inbox/fetching? db) + ;; if chat was removed before messages were fetched no need + ;; to proceed with further actions + (or (not chat-id) (contains? (:transport/chats db) chat-id))) (let [time-since-last-received (- now (:inbox/last-received db))] (if (> time-since-last-received fetching-timeout) (if chat-id