Skip to content

Commit 6fa5f05

Browse files
authored
Tokens aren't refetched on active networks disabling/enabling (#22641)
* Tokens aren't refetched on active networks disabling/enabling * fix losing tokens on switching from/to test networks
1 parent f1516ea commit 6fa5f05

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/status_im/contexts/wallet/common/utils/networks.cljs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
(first (filter #(or (= (:chain-id %) chain-id)
1414
(= (:related-chain-id %) chain-id))
1515
networks))))
16+
(remove nil?)
1617
set))
1718

1819
(defn balance-is-sufficient-to-use-chain

src/status_im/contexts/wallet/networks/events.cljs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@
7373
{:fx [[:dispatch [:wallet/reset-accounts-tokens]]
7474
[:dispatch [:wallet/reload-cached-balances]]
7575
[:dispatch [:wallet/reload-collectibles]]
76-
[:dispatch [:wallet.tokens/reset-tokens]]
77-
[:dispatch [:wallet.tokens/get-token-list]]
7876
[:dispatch [:wallet/check-new-networks-seen]]]}))
7977

8078
(rf/reg-event-fx :wallet/update-network-active
@@ -104,7 +102,9 @@
104102
(fn [{:keys [db]} [testnet?]]
105103
{:db (assoc-in db [:profile/profile :test-networks-enabled?] testnet?)
106104
:fx [[:dispatch [:profile/toggle-testnet-mode-banner]]
107-
[:dispatch [:wallet/on-active-networks-change]]]}))
105+
[:dispatch [:wallet/on-active-networks-change]]
106+
[:dispatch [:wallet.tokens/reset-tokens]]
107+
[:dispatch [:wallet.tokens/get-token-list]]]}))
108108

109109
(rf/reg-event-fx
110110
:wallet/mark-new-networks-as-seen

0 commit comments

Comments
 (0)