From af018a2d746d57080f4d06acda93dfa97dc56ab3 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Wed, 14 Oct 2020 21:50:37 -0230 Subject: [PATCH] Clear all gas slice state on entering and leaving swaps (#9609) --- ui/app/ducks/swaps/swaps.js | 4 ++-- ui/app/pages/swaps/index.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/app/ducks/swaps/swaps.js b/ui/app/ducks/swaps/swaps.js index 9d912ad8c..60f6ab9d0 100644 --- a/ui/app/ducks/swaps/swaps.js +++ b/ui/app/ducks/swaps/swaps.js @@ -38,7 +38,7 @@ import { SWAP_FAILED_ERROR, } from '../../helpers/constants/swaps' import { SWAP, SWAP_APPROVAL } from '../../helpers/constants/transactions' -import { fetchBasicGasAndTimeEstimates, fetchGasEstimates, resetCustomData } from '../gas/gas.duck' +import { fetchBasicGasAndTimeEstimates, fetchGasEstimates, resetCustomGasState } from '../gas/gas.duck' import { formatCurrency } from '../../helpers/utils/confirm-tx.util' const initialState = { @@ -235,7 +235,7 @@ export const prepareForRetryGetQuotes = () => { export const prepareToLeaveSwaps = () => { return async (dispatch) => { - dispatch(resetCustomData()) + dispatch(resetCustomGasState()) dispatch(clearSwapsState()) await dispatch(resetBackgroundSwapsState()) diff --git a/ui/app/pages/swaps/index.js b/ui/app/pages/swaps/index.js index 206489b8c..ea38f53b7 100644 --- a/ui/app/pages/swaps/index.js +++ b/ui/app/pages/swaps/index.js @@ -25,6 +25,7 @@ import { prepareToLeaveSwaps, fetchAndSetSwapsGasPriceInfo, } from '../../ducks/swaps/swaps' +import { resetCustomGasState } from '../../ducks/gas/gas.duck' import { AWAITING_SWAP_ROUTE, BUILD_QUOTE_ROUTE, @@ -159,6 +160,7 @@ export default function Swap () { dispatch(setMetamaskFeeAmount(metaMaskFeeAmount)) }) + dispatch(resetCustomGasState()) dispatch(fetchAndSetSwapsGasPriceInfo()) return () => {