Fix `div` error after amount is set as fiat (#21732)
* fix: cleanup send state on input unmount * fix: switching default val to fiat filled input with 0.00
This commit is contained in:
parent
6ce58db7b9
commit
caaff74efe
|
@ -150,15 +150,19 @@
|
||||||
|
|
||||||
(defn- fiat->crypto
|
(defn- fiat->crypto
|
||||||
[value conversion-rate]
|
[value conversion-rate]
|
||||||
(-> value
|
(if-not (string/blank? value)
|
||||||
(money/fiat->crypto conversion-rate)
|
(-> value
|
||||||
(wallet-utils/cut-crypto-decimals-to-fit-usd-cents conversion-rate)))
|
(money/fiat->crypto conversion-rate)
|
||||||
|
(wallet-utils/cut-crypto-decimals-to-fit-usd-cents conversion-rate))
|
||||||
|
""))
|
||||||
|
|
||||||
(defn- crypto->fiat
|
(defn- crypto->fiat
|
||||||
[value conversion-rate]
|
[value conversion-rate]
|
||||||
(-> value
|
(if-not (string/blank? value)
|
||||||
(money/crypto->fiat conversion-rate)
|
(-> value
|
||||||
(wallet-utils/cut-fiat-balance-to-two-decimals)))
|
(money/crypto->fiat conversion-rate)
|
||||||
|
(wallet-utils/cut-fiat-balance-to-two-decimals))
|
||||||
|
""))
|
||||||
|
|
||||||
(defn ->crypto
|
(defn ->crypto
|
||||||
[state conversion-rate]
|
[state conversion-rate]
|
||||||
|
|
|
@ -612,7 +612,7 @@
|
||||||
|
|
||||||
(rf/reg-event-fx :wallet/clean-up-transaction-flow
|
(rf/reg-event-fx :wallet/clean-up-transaction-flow
|
||||||
(fn [_]
|
(fn [_]
|
||||||
{:fx [[:dispatch [:dismiss-modal :screen/wallet.transaction-confirmation]]
|
{:fx [[:dispatch [:wallet/clean-send-data]]
|
||||||
[: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]]
|
||||||
|
@ -622,11 +622,9 @@
|
||||||
(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 [:wallet/navigate-to-account-within-stack address]]
|
{:fx [[:dispatch [:dismiss-modal :screen/wallet.transaction-confirmation]]
|
||||||
[:dispatch [:wallet/select-account-tab :activity]]
|
[:dispatch [:wallet/navigate-to-account-within-stack address]]
|
||||||
[:dispatch-later
|
[:dispatch [:wallet/select-account-tab :activity]]]})))
|
||||||
[{: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
|
||||||
|
@ -693,7 +691,6 @@
|
||||||
:params [{:uuid (get-in transaction-for-signing [:sendDetails :uuid])
|
:params [{:uuid (get-in transaction-for-signing [:sendDetails :uuid])
|
||||||
:signatures signatures-map}]
|
:signatures signatures-map}]
|
||||||
:on-success (fn []
|
:on-success (fn []
|
||||||
(rf/dispatch [:wallet/clean-send-data])
|
|
||||||
(rf/dispatch [:hide-bottom-sheet]))
|
(rf/dispatch [:hide-bottom-sheet]))
|
||||||
:on-error (fn [error]
|
:on-error (fn [error]
|
||||||
(log/error "failed to send router transactions with signatures"
|
(log/error "failed to send router transactions with signatures"
|
||||||
|
|
|
@ -258,6 +258,8 @@
|
||||||
(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?
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
[utils.re-frame :as rf]
|
[utils.re-frame :as rf]
|
||||||
[utils.string :as utils.string]))
|
[utils.string :as utils.string]))
|
||||||
|
|
||||||
(def ^:private default-text-for-unfocused-input "0.00")
|
(def ^:private default-text-for-unfocused-input "0")
|
||||||
(def ^:private swap-proposal-debounce-time-ms 1000)
|
(def ^:private swap-proposal-debounce-time-ms 1000)
|
||||||
|
|
||||||
(defn- on-close
|
(defn- on-close
|
||||||
|
|
Loading…
Reference in New Issue