Commit 8de048bc authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

fix: input amount lag (#3503)

Propagates the exact amount to the trade currency amount without waiting for the trade to be computed. This allows things like insufficient balance or approval to be reflected in the UI while typing, instead of having a lag.
parent 163e2d55
...@@ -60,8 +60,8 @@ function useComputeSwapInfo(): SwapInfo { ...@@ -60,8 +60,8 @@ function useComputeSwapInfo(): SwapInfo {
const tradeCurrencyAmounts = useMemo( const tradeCurrencyAmounts = useMemo(
() => ({ () => ({
// Use same amount for input and output if user is wrapping. // Use same amount for input and output if user is wrapping.
[Field.INPUT]: isWrapping ? parsedAmount : trade.trade?.inputAmount, [Field.INPUT]: isWrapping || isExactIn ? parsedAmount : trade.trade?.inputAmount,
[Field.OUTPUT]: isWrapping ? parsedAmount : trade.trade?.outputAmount, [Field.OUTPUT]: isWrapping || !isExactIn ? parsedAmount : trade.trade?.outputAmount,
}), }),
[isWrapping, parsedAmount, trade.trade?.inputAmount, trade.trade?.outputAmount] [isWrapping, parsedAmount, trade.trade?.inputAmount, trade.trade?.outputAmount]
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment