From 6a3794f380ae3298f627d5426669b1063fc94cb2 Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Fri, 14 Jun 2024 18:07:00 +0400 Subject: [PATCH] fix(wallet): Wallet Home jumping (#20347) --- .../components/wallet/wallet_overview/style.cljs | 5 +++-- src/quo/components/wallet/wallet_overview/view.cljs | 2 +- src/status_im/contexts/profile/login/events.cljs | 2 +- src/status_im/contexts/wallet/db.cljs | 3 ++- src/status_im/subs/wallet/wallet.cljs | 13 ++++++++----- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/quo/components/wallet/wallet_overview/style.cljs b/src/quo/components/wallet/wallet_overview/style.cljs index d5a022364b..5d0c718337 100644 --- a/src/quo/components/wallet/wallet_overview/style.cljs +++ b/src/quo/components/wallet/wallet_overview/style.cljs @@ -2,12 +2,13 @@ (:require [quo.foundations.colors :as colors])) -(def container-info +(defn container-info + [{:keys [metrics]}] {:padding-horizontal 20 :padding-top 12 :padding-bottom 32 :flex-grow 1 - :max-height 98}) + :height (if (= metrics :none) 78 98)}) (def container-info-top {:flex-direction :row diff --git a/src/quo/components/wallet/wallet_overview/view.cljs b/src/quo/components/wallet/wallet_overview/view.cljs index 8d02176876..1312046e50 100644 --- a/src/quo/components/wallet/wallet_overview/view.cljs +++ b/src/quo/components/wallet/wallet_overview/view.cljs @@ -116,7 +116,7 @@ (defn- view-internal [props] - [rn/view {:style style/container-info} + [rn/view {:style (style/container-info props)} [view-info-top props] [view-info-bottom props]]) diff --git a/src/status_im/contexts/profile/login/events.cljs b/src/status_im/contexts/profile/login/events.cljs index 23744cb091..20bec6d444 100644 --- a/src/status_im/contexts/profile/login/events.cljs +++ b/src/status_im/contexts/profile/login/events.cljs @@ -59,7 +59,6 @@ :on-error #(log/error "failed to start messenger" %)}]] [:dispatch [:universal-links/generate-profile-url]] [:dispatch [:community/fetch]] - [:dispatch [:wallet/initialize]] [:push-notifications/load-preferences] [:profile.config/get-node-config] [:logs/set-level log-level] @@ -145,6 +144,7 @@ (when (and new-account? (not recovered-account?)) [:dispatch [:wallet-legacy/set-initial-blocks-range]]) [:dispatch [:ens/update-usernames ensUsernames]] + [:dispatch [:wallet/initialize]] [:dispatch [:profile.login/login-existing-profile settings account]]]}))) (rf/reg-event-fx diff --git a/src/status_im/contexts/wallet/db.cljs b/src/status_im/contexts/wallet/db.cljs index 6d98804f13..2e53cb87f9 100644 --- a/src/status_im/contexts/wallet/db.cljs +++ b/src/status_im/contexts/wallet/db.cljs @@ -6,4 +6,5 @@ :selected-networks (set constants/default-network-names)}) (def defaults - {:ui {:network-filter network-filter-defaults}}) + {:ui {:network-filter network-filter-defaults + :tokens-loading {}}}) diff --git a/src/status_im/subs/wallet/wallet.cljs b/src/status_im/subs/wallet/wallet.cljs index 56f647834b..9d15c82608 100644 --- a/src/status_im/subs/wallet/wallet.cljs +++ b/src/status_im/subs/wallet/wallet.cljs @@ -47,10 +47,12 @@ :wallet/home-tokens-loading? :<- [:wallet/tokens-loading] (fn [tokens-loading] - (->> tokens-loading - vals - (some true?) - boolean))) + (if (empty? tokens-loading) + true + (->> tokens-loading + vals + (some true?) + boolean)))) (rf/reg-sub :wallet/current-viewing-account-tokens-loading? @@ -335,7 +337,8 @@ :customization-color color :type (if watch-only? :watch-only :empty) :on-press #(rf/dispatch [:wallet/navigate-to-account address]) - :loading? (get tokens-loading address) + :loading? (or (get tokens-loading address) + (not (contains? tokens-loading address))) :balance (utils/prettify-balance currency-symbol (get balances address)))) accounts)))