diff --git a/ui/ducks/swaps/swaps.js b/ui/ducks/swaps/swaps.js index 6032d46814ef..fab4e3288237 100644 --- a/ui/ducks/swaps/swaps.js +++ b/ui/ducks/swaps/swaps.js @@ -973,7 +973,6 @@ export const signAndSendSwapsSmartTransaction = ({ ); if (!fees) { log.error('"fetchSwapsSmartTransactionFees" failed'); - dispatch(setSwapsSTXSubmitLoading(false)); dispatch(setCurrentSmartTransactionsError(StxErrorTypes.unavailable)); return; } @@ -1026,7 +1025,6 @@ export const signAndSendSwapsSmartTransaction = ({ ); } history.push(SMART_TRANSACTION_STATUS_ROUTE); - dispatch(setSwapsSTXSubmitLoading(false)); } catch (e) { console.log('signAndSendSwapsSmartTransaction error', e); const { @@ -1036,6 +1034,8 @@ export const signAndSendSwapsSmartTransaction = ({ const errorObj = parseSmartTransactionsError(e.message); dispatch(setCurrentSmartTransactionsError(errorObj?.error)); } + } finally { + dispatch(setSwapsSTXSubmitLoading(false)); } }; }; diff --git a/ui/pages/swaps/prepare-swap-page/review-quote.js b/ui/pages/swaps/prepare-swap-page/review-quote.js index 0dc3f89009cb..7713c871adc1 100644 --- a/ui/pages/swaps/prepare-swap-page/review-quote.js +++ b/ui/pages/swaps/prepare-swap-page/review-quote.js @@ -963,17 +963,19 @@ export default function ReviewQuote({ setReceiveToAmount }) { }, [dispatch, trackViewQuotePageLoadedEvent, reviewSwapClickedTimestamp]); useEffect(() => { - // if smart transaction error is turned off, reset submit clicked boolean if ( - !currentSmartTransactionsEnabled && - currentSmartTransactionsError && - submitClicked + (!currentSmartTransactionsEnabled && + currentSmartTransactionsError && + submitClicked) || + (isSmartTransaction && !swapsSTXLoading && submitClicked) ) { setSubmitClicked(false); } }, [ currentSmartTransactionsEnabled, currentSmartTransactionsError, + isSmartTransaction, + swapsSTXLoading, submitClicked, ]);