Do not update disabled networks when receiver network updated (#20756)
This commit is contained in:
parent
02e24208db
commit
06b2996167
|
@ -187,15 +187,8 @@
|
|||
(rf/reg-event-fx
|
||||
:wallet/update-receiver-networks
|
||||
(fn [{:keys [db]} [selected-networks]]
|
||||
(let [amount (get-in db [:wallet :ui :send :amount])
|
||||
disabled-from-chain-ids (get-in db [:wallet :ui :send :disabled-from-chain-ids])
|
||||
filtered-disabled-from-chain-ids (filter (fn [chain-id]
|
||||
(some #(= chain-id %)
|
||||
selected-networks))
|
||||
disabled-from-chain-ids)]
|
||||
{:db (-> db
|
||||
(assoc-in [:wallet :ui :send :receiver-networks] selected-networks)
|
||||
(assoc-in [:wallet :ui :send :disabled-from-chain-ids] filtered-disabled-from-chain-ids))
|
||||
(let [amount (get-in db [:wallet :ui :send :amount])]
|
||||
{:db (assoc-in db [:wallet :ui :send :receiver-networks] selected-networks)
|
||||
:fx [[:dispatch [:wallet/get-suggested-routes {:amount amount}]]]})))
|
||||
|
||||
(rf/reg-event-fx
|
||||
|
|
|
@ -23,19 +23,6 @@
|
|||
selected-networks-after [:ethereum :optimism]
|
||||
expected-db {:wallet {:ui {:send {:receiver-networks selected-networks-after}}}}]
|
||||
(reset! rf-db/app-db {:wallet {:ui {:send {:receiver-networks selected-networks-before}}}})
|
||||
(is (match? expected-db (:db (dispatch [event-id selected-networks-after]))))))
|
||||
|
||||
(testing "if receiver network removed, it is also removed from disabled ones"
|
||||
(let [selected-networks-before [:ethereum :optimism :arbitrum]
|
||||
selected-networks-after [:ethereum :optimism]
|
||||
disabled-from-chain-ids-before [:optimism :arbitrum]
|
||||
disabled-from-chain-ids-after [:optimism]
|
||||
expected-db {:wallet {:ui {:send {:receiver-networks selected-networks-after
|
||||
:disabled-from-chain-ids
|
||||
disabled-from-chain-ids-after}}}}]
|
||||
(reset! rf-db/app-db {:wallet {:ui {:send {:receiver-networks selected-networks-before
|
||||
:disabled-from-chain-ids
|
||||
disabled-from-chain-ids-before}}}})
|
||||
(is (match? expected-db (:db (dispatch [event-id selected-networks-after])))))))
|
||||
|
||||
(h/deftest-event :wallet/set-token-to-send
|
||||
|
|
Loading…
Reference in New Issue