From a0d8c22f84a2e3d4c8718d78b1e65f373c3c1955 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 4 Jan 2017 10:58:46 +0200 Subject: [PATCH] another attempt to fix issue #607 --- src/status_im/chat/handlers.cljs | 4 +++- src/status_im/commands/handlers/loading.cljs | 3 ++- src/status_im/protocol/handlers.cljs | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/status_im/chat/handlers.cljs b/src/status_im/chat/handlers.cljs index 87de93247a..d2f9360062 100644 --- a/src/status_im/chat/handlers.cljs +++ b/src/status_im/chat/handlers.cljs @@ -362,7 +362,9 @@ (when (= current-chat-id wallet-chat-id) (dispatch [:cancel-command])) (dispatch [:load-requests! chat-id]) - (if-not commands-loaded? + ;; todo rewrite this. temporary fix for https://github.com/status-im/status-react/issues/607 + (dispatch [:load-commands! chat-id]) + #_(if-not commands-loaded? (dispatch [:load-commands! chat-id]) (dispatch [:invoke-chat-loaded-callbacks chat-id])) (if (and (seq messages) diff --git a/src/status_im/commands/handlers/loading.cljs b/src/status_im/commands/handlers/loading.cljs index aae6f215e6..17179b3cb7 100644 --- a/src/status_im/commands/handlers/loading.cljs +++ b/src/status_im/commands/handlers/loading.cljs @@ -20,7 +20,8 @@ (let [identity (or identity current-chat-id) contact (or (get contacts identity) {:whisper-identity identity})] - (dispatch [::fetch-commands! contact])) + (when identity + (dispatch [::fetch-commands! contact]))) ;; todo uncomment #_(if-let [{:keys [file]} (commands/get-by-chat-id identity)] (dispatch [::parse-commands! identity file]) diff --git a/src/status_im/protocol/handlers.cljs b/src/status_im/protocol/handlers.cljs index 598df8940e..b16ad3c288 100644 --- a/src/status_im/protocol/handlers.cljs +++ b/src/status_im/protocol/handlers.cljs @@ -410,4 +410,5 @@ (let [message (.-message error)] (when (or (re-find (re-pattern "Could not connect to the server.") message) (re-find (re-pattern "Failed to connect") message)) - (status/restart-rpc)))))) + (status/restart-rpc) + (dispatch [:load-commands!]))))))