Skip to content

Commit

Permalink
fix: send max button ui update (#1762)
Browse files Browse the repository at this point in the history
* fix: send max button ui update

* chore: cleanup
  • Loading branch information
0xKheops authored Dec 19, 2024
1 parent 0fdb106 commit 6124cc9
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ const TokenInput = ({ onTokenClick }: { onTokenClick: () => void }) => {
useInputAutoWidth(refTokensInput)

useEffect(() => {
if (sendMax && refTokensInput.current && transfer?.tokens) {
const expectedInputValue = normalizeStringNumber(transfer.tokens, token?.decimals)
if (sendMax && refTokensInput.current && maxAmount?.tokens) {
const expectedInputValue = normalizeStringNumber(maxAmount.tokens, token?.decimals)
if (refTokensInput.current.value !== expectedInputValue)
refTokensInput.current.value = expectedInputValue
}
}, [amount, transfer, sendMax, token])
}, [amount, sendMax, token, maxAmount])

const defaultValue = useMemo(
() =>
Expand Down Expand Up @@ -125,12 +125,12 @@ const FiatInput = () => {
const currency = useSelectedCurrency()

useEffect(() => {
if (sendMax && refFiatInput.current && typeof transfer?.fiat(currency) === "number") {
const expectedInputValue = transfer?.fiat(currency)?.toString() ?? ""
if (sendMax && refFiatInput.current && typeof maxAmount?.fiat(currency) === "number") {
const expectedInputValue = maxAmount?.fiat(currency)?.toString() ?? ""
if (refFiatInput.current.value !== expectedInputValue)
refFiatInput.current.value = expectedInputValue
}
}, [transfer, sendMax, currency])
}, [sendMax, currency, maxAmount])

const defaultValue = useMemo(
() =>
Expand Down

0 comments on commit 6124cc9

Please sign in to comment.