1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Clear all gas slice state on entering and leaving swaps (#9609)

This commit is contained in:
Dan J Miller 2020-10-14 21:50:37 -02:30 committed by GitHub
parent 83fe472779
commit af018a2d74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -38,7 +38,7 @@ import {
SWAP_FAILED_ERROR, SWAP_FAILED_ERROR,
} from '../../helpers/constants/swaps' } from '../../helpers/constants/swaps'
import { SWAP, SWAP_APPROVAL } from '../../helpers/constants/transactions' 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' import { formatCurrency } from '../../helpers/utils/confirm-tx.util'
const initialState = { const initialState = {
@ -235,7 +235,7 @@ export const prepareForRetryGetQuotes = () => {
export const prepareToLeaveSwaps = () => { export const prepareToLeaveSwaps = () => {
return async (dispatch) => { return async (dispatch) => {
dispatch(resetCustomData()) dispatch(resetCustomGasState())
dispatch(clearSwapsState()) dispatch(clearSwapsState())
await dispatch(resetBackgroundSwapsState()) await dispatch(resetBackgroundSwapsState())

View File

@ -25,6 +25,7 @@ import {
prepareToLeaveSwaps, prepareToLeaveSwaps,
fetchAndSetSwapsGasPriceInfo, fetchAndSetSwapsGasPriceInfo,
} from '../../ducks/swaps/swaps' } from '../../ducks/swaps/swaps'
import { resetCustomGasState } from '../../ducks/gas/gas.duck'
import { import {
AWAITING_SWAP_ROUTE, AWAITING_SWAP_ROUTE,
BUILD_QUOTE_ROUTE, BUILD_QUOTE_ROUTE,
@ -159,6 +160,7 @@ export default function Swap () {
dispatch(setMetamaskFeeAmount(metaMaskFeeAmount)) dispatch(setMetamaskFeeAmount(metaMaskFeeAmount))
}) })
dispatch(resetCustomGasState())
dispatch(fetchAndSetSwapsGasPriceInfo()) dispatch(fetchAndSetSwapsGasPriceInfo())
return () => { return () => {