Merge pull request #263 from status-im/fix/metamask-address-not-updated-#187

[FIX #187] Fix issue with "Select address" appearing after refresh
This commit is contained in:
Vitaliy Vlasov 2018-02-15 11:04:23 +02:00 committed by GitHub
commit 714b869a72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 3 deletions

View File

@ -4,6 +4,7 @@
(def default-db (def default-db
{:page :bounties {:page :bounties
:user nil :user nil
:user-profile-loaded? false
:repos-loading? false :repos-loading? false
:repos {} :repos {}
:activity-feed-loading? false :activity-feed-loading? false

View File

@ -225,7 +225,8 @@
:set-user-profile :set-user-profile
(fn [{:keys [db]} [_ user-profile]] (fn [{:keys [db]} [_ user-profile]]
{:db {:db
(assoc db :user (:user user-profile)) (assoc db :user (:user user-profile)
:user-profile-loaded? true)
:dispatch-n [[:load-user-repos] :dispatch-n [[:load-user-repos]
[:load-owner-bounties]]})) [:load-owner-bounties]]}))

View File

@ -19,6 +19,11 @@
(fn [db _] (fn [db _]
(:user db))) (:user db)))
(reg-sub
:user-profile-loaded?
(fn [db _]
(:user-profile-loaded? db)))
(reg-sub (reg-sub
:repos-loading? :repos-loading?
(fn [db _] (fn [db _]

View File

@ -5,8 +5,7 @@
[reagent.crypt :as crypt] [reagent.crypt :as crypt]
[cljs-web3.eth :as web3-eth])) [cljs-web3.eth :as web3-eth]))
(defn update-address-page-contents []
(defn update-address-page []
(let [db (rf/subscribe [:db]) (let [db (rf/subscribe [:db])
user (rf/subscribe [:user]) user (rf/subscribe [:user])
updating-address (rf/subscribe [:get-in [:updating-address]]) updating-address (rf/subscribe [:get-in [:updating-address]])
@ -42,3 +41,11 @@
(when @updating-address (when @updating-address
" busy loading"))}) " busy loading"))})
"UPDATE"]]])))) "UPDATE"]]]))))
(defn update-address-page []
(let [loaded? @(rf/subscribe [:user-profile-loaded?])]
(if loaded?
[update-address-page-contents]
[:div.view-loading-container
[:div.ui.active.inverted.dimmer
[:div.ui.text.loader.view-loading-label "Loading"]]])))