From e1e00dde4ed48dfb5c6dda2c33a525ce3c25dfde Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Wed, 8 Mar 2017 17:50:06 +0300 Subject: [PATCH] fix for https://github.com/status-im/status-react/issues/643 --- src/status_im/navigation/handlers.cljs | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/status_im/navigation/handlers.cljs b/src/status_im/navigation/handlers.cljs index c342202a76..a63a752eec 100644 --- a/src/status_im/navigation/handlers.cljs +++ b/src/status_im/navigation/handlers.cljs @@ -12,7 +12,7 @@ (let [stack' (if (> 2 (count stack)) (list :chat-list) (pop stack))] - (conj stack' view-id))) + (conj stack' view-id))) (defn replace-view [db view-id] (-> db @@ -75,13 +75,22 @@ (assoc db :view-id first-in-stack))) db)))) +(defn navigate-to-clean + [db [_ view-id]] + (-> db + (assoc :navigation-stack (list)) + (push-view view-id))) + +(register-handler :navigate-to-clean navigate-to-clean) + (register-handler :navigate-to-tab - (enrich preload-data!) - (fn [db [_ view-id]] - (-> db - (assoc :prev-tab-view-id (:view-id db)) - (assoc :prev-view-id (:view-id db)) - (replace-view view-id)))) + (-> + (fn [db [_ view-id]] + (-> db + (assoc :prev-tab-view-id (:view-id db)) + (assoc :prev-view-id (:view-id db)))) + ((enrich navigate-to-clean)) + ((enrich preload-data!)))) (register-handler :on-navigated-to-tab (enrich preload-data!) @@ -95,10 +104,3 @@ (register-handler :show-profile show-profile) -(defn navigate-to-clean - [db [_ view-id]] - (-> db - (assoc :navigation-stack (list)) - (push-view view-id))) - -(register-handler :navigate-to-clean navigate-to-clean)