From cbc2ff668ed65980130f6197d20094b1c5877260 Mon Sep 17 00:00:00 2001 From: Ian Lapham Date: Thu, 17 Mar 2022 16:26:37 -0700 Subject: [PATCH] disable swap button if trade not populated (#3542) --- src/lib/components/Swap/SwapButton.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib/components/Swap/SwapButton.tsx b/src/lib/components/Swap/SwapButton.tsx index b98f06a664..26698e70a0 100644 --- a/src/lib/components/Swap/SwapButton.tsx +++ b/src/lib/components/Swap/SwapButton.tsx @@ -94,13 +94,24 @@ export default memo(function SwapButton({ disabled }: SwapButtonProps) { const disableSwap = useMemo( () => disabled || + !optimizedTrade || !chainId || wrapLoading || (wrapType !== WrapType.NOT_APPLICABLE && wrapError) || approvalState === ApproveOrPermitState.PENDING_SIGNATURE || !(inputTradeCurrencyAmount && inputCurrencyBalance) || inputCurrencyBalance.lessThan(inputTradeCurrencyAmount), - [disabled, chainId, wrapLoading, wrapType, wrapError, approvalState, inputTradeCurrencyAmount, inputCurrencyBalance] + [ + disabled, + optimizedTrade, + chainId, + wrapLoading, + wrapType, + wrapError, + approvalState, + inputTradeCurrencyAmount, + inputCurrencyBalance, + ] ) const actionProps = useMemo((): Partial | undefined => {