fix(wallet)_: tx data cleanup after send or bridge tx (#21770)

This commit fixes the token/networks going to zero/disabled in the "Bridge to" screen when the user navigates back from the input screen.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit is contained in:
Mohamed Javid 2024-12-09 20:02:48 +05:30 committed by GitHub
parent 2150f6db48
commit 3c3ef20769
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 7 deletions

View File

@ -619,7 +619,7 @@
(rf/reg-event-fx :wallet/clean-up-transaction-flow (rf/reg-event-fx :wallet/clean-up-transaction-flow
(fn [_] (fn [_]
{:fx [[:dispatch [:wallet/clean-send-data]] {:fx [[:dispatch [:dismiss-modal :screen/wallet.transaction-confirmation]]
[:dispatch [:wallet/clean-scanned-address]] [:dispatch [:wallet/clean-scanned-address]]
[:dispatch [:wallet/clean-local-suggestions]] [:dispatch [:wallet/clean-local-suggestions]]
[:dispatch [:wallet/clean-send-address]] [:dispatch [:wallet/clean-send-address]]
@ -629,9 +629,11 @@
(rf/reg-event-fx :wallet/end-transaction-flow (rf/reg-event-fx :wallet/end-transaction-flow
(fn [{:keys [db]}] (fn [{:keys [db]}]
(let [address (get-in db [:wallet :current-viewing-account-address])] (let [address (get-in db [:wallet :current-viewing-account-address])]
{:fx [[:dispatch [:dismiss-modal :screen/wallet.transaction-confirmation]] {:fx [[:dispatch [:wallet/navigate-to-account-within-stack address]]
[:dispatch [:wallet/navigate-to-account-within-stack address]] [:dispatch [:wallet/select-account-tab :activity]]
[:dispatch [:wallet/select-account-tab :activity]]]}))) [:dispatch-later
[{:ms 20
:dispatch [:wallet/clean-up-transaction-flow]}]]]})))
(rf/reg-event-fx (rf/reg-event-fx
:wallet/build-transactions-from-route :wallet/build-transactions-from-route

View File

@ -258,8 +258,6 @@
(set-input-state (set-input-state
#(controlled-input/->crypto % conversion-rate))) #(controlled-input/->crypto % conversion-rate)))
(set-crypto-currency (not crypto-currency?)))] (set-crypto-currency (not crypto-currency?)))]
(rn/use-unmount
#(rf/dispatch [:wallet/clean-up-transaction-flow]))
(rn/use-effect (rn/use-effect
(fn [] (fn []
(when active-screen? (when active-screen?

View File

@ -285,10 +285,14 @@
[bn1 bn2] [bn1 bn2]
(.round (.mul ^js bn1 bn2) 0)) (.round (.mul ^js bn1 bn2) 0))
(defn div (defn- div*
[bn1 bn2] [bn1 bn2]
(.dividedBy ^js bn1 bn2)) (.dividedBy ^js bn1 bn2))
(def div
"Divides with defaults, this version is able to receive `nil` and takes them as 0."
(fnil div* (bignumber 0) (bignumber 1)))
(defn div-and-round (defn div-and-round
[bn1 bn2] [bn1 bn2]
(.round (.dividedBy ^js bn1 bn2) 0)) (.round (.dividedBy ^js bn1 bn2) 0))