Skip to content

Commit 0510a3f

Browse files
committed
fix: continue button remained disabled when updating swapOut amount
1 parent d3d96e9 commit 0510a3f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/features/swap/components/SwapFormInputs.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ export function SwapFormInputs({ balances }: Props) {
3030
const { isLoading, quote, rate } = useSwapQuote(amount, direction, fromTokenId, toTokenId)
3131

3232
useEffect(() => {
33-
if (values.direction === 'in' && quote && values.quote !== quote) {
34-
setFieldValue('quote', quote)
35-
}
36-
}, [quote, setFieldValue, values.direction, values.quote])
33+
if (!quote || values.quote === quote) return
34+
35+
// For direction 'in', quote is the output amount
36+
// For direction 'out', quote is the input amount
37+
setFieldValue('quote', quote)
38+
}, [quote, setFieldValue, values.quote])
3739

3840
return (
3941
<div className="flex flex-col gap-3">

0 commit comments

Comments
 (0)