diff --git a/src/status_im/chat/models.cljs b/src/status_im/chat/models.cljs index 00cc69559f..cf4e9f2664 100644 --- a/src/status_im/chat/models.cljs +++ b/src/status_im/chat/models.cljs @@ -243,8 +243,7 @@ (chat.state/reset-visible-item) (fx/merge cofx {:db (dissoc db :current-chat-id)} - (offload-messages chat-id) - (navigation/navigate-back)))) + (offload-messages chat-id)))) (fx/defn remove-chat "Removes chat completely from app, producing all necessary effects for that" diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index 9192fe1e76..3b79b62c88 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -968,7 +968,7 @@ [(re-frame/subscribe [:chats/raw-chat-messages-stream chat-id]) (re-frame/subscribe [:view-id])]) (fn [[messages view-id]] - (if (= view-id :chat) + (if (or (= view-id :chat) (empty? messages)) (do (reset! memo-chat-messages-stream messages) messages) @@ -982,7 +982,7 @@ [(re-frame/subscribe [:chats/raw-chat-messages-stream chat-id]) (re-frame/subscribe [:view-id])]) (fn [[messages view-id]] - (if (= view-id :profile) + (if (or (= view-id :profile) (empty? messages)) (do (reset! memo-profile-messages-stream messages) messages) diff --git a/src/status_im/ui/screens/chat/views.cljs b/src/status_im/ui/screens/chat/views.cljs index 93b1b3d83c..1a8d96d7d8 100644 --- a/src/status_im/ui/screens/chat/views.cljs +++ b/src/status_im/ui/screens/chat/views.cljs @@ -37,7 +37,7 @@ (defn topbar [] ;;we don't use topbar component, because we want chat view as simple (fast) as possible [react/view {:height 56 :border-bottom-width 1 :border-bottom-color (:ui-01 @quo.colors/theme)} - [react/touchable-highlight {:on-press-in #(re-frame/dispatch [:close-chat]) + [react/touchable-highlight {:on-press-in #(re-frame/dispatch [:navigate-back]) :accessibility-label :back-button :style {:height 56 :width 40 :align-items :center :justify-content :center :padding-left 16}} @@ -331,7 +331,7 @@ set-active-panel (get-set-active-panel active-panel) on-close #(set-active-panel nil)] (reagent/create-class - {:component-will-unmount #(re-frame/dispatch-sync [:close-chat]) + {:component-will-unmount #(re-frame/dispatch [:close-chat]) :reagent-render (fn [] (let [{:keys [chat-id show-input? group-chat admins invitation-admin] :as chat} diff --git a/src/status_im/ui/screens/routing/main.cljs b/src/status_im/ui/screens/routing/main.cljs index 80a4d3c968..fd677eff3c 100644 --- a/src/status_im/ui/screens/routing/main.cljs +++ b/src/status_im/ui/screens/routing/main.cljs @@ -59,7 +59,7 @@ :insets {:top false} :component profile-stack/profile-stack}]]) -(views/defview get-main-component [_] +(views/defview main-nav-component [] (views/letsubs [logged-in? [:multiaccount/logged-in?] keycard-account? [:multiaccounts/keycard-account?]] [main-stack (merge {:header-mode :none} diff --git a/src/status_im/ui/screens/views.cljs b/src/status_im/ui/screens/views.cljs index 855684fcea..f852bd204a 100644 --- a/src/status_im/ui/screens/views.cljs +++ b/src/status_im/ui/screens/views.cljs @@ -53,8 +53,6 @@ (when debug? (persist-state! state))) -(defonce main-app-navigator (partial routing/get-main-component false)) - (defn root [_] (reagent/create-class {:component-did-mount @@ -83,7 +81,7 @@ (when debug? {:enableURLHandling true :initialState @state})) - [main-app-navigator]] + [routing/main-nav-component]] [wallet/select-account] [signing/signing] [bottom-sheets/bottom-sheet]