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

Clear custom gas data on hiding of gas customization modal.

This commit is contained in:
Dan Miller 2018-11-13 14:55:34 -03:30
parent f8ffdaedc9
commit 75d7545437

View File

@ -4,6 +4,7 @@ const inherits = require('util').inherits
const connect = require('react-redux').connect const connect = require('react-redux').connect
const FadeModal = require('boron').FadeModal const FadeModal = require('boron').FadeModal
const actions = require('../../actions') const actions = require('../../actions')
const { resetCustomData: resetCustomGasData } = require('../../ducks/gas.duck')
const isMobileView = require('../../../lib/is-mobile-view') const isMobileView = require('../../../lib/is-mobile-view')
const { getEnvironmentType } = require('../../../../app/scripts/lib/util') const { getEnvironmentType } = require('../../../../app/scripts/lib/util')
const { ENVIRONMENT_TYPE_POPUP } = require('../../../../app/scripts/lib/enums') const { ENVIRONMENT_TYPE_POPUP } = require('../../../../app/scripts/lib/enums')
@ -317,6 +318,10 @@ const MODALS = {
contentStyle: { contentStyle: {
borderRadius: '8px', borderRadius: '8px',
}, },
customOnHideOpts: {
action: resetCustomGasData,
args: [],
},
}, },
TRANSACTION_CONFIRMED: { TRANSACTION_CONFIRMED: {
@ -392,8 +397,11 @@ function mapStateToProps (state) {
function mapDispatchToProps (dispatch) { function mapDispatchToProps (dispatch) {
return { return {
hideModal: () => { hideModal: (customOnHideOpts) => {
dispatch(actions.hideModal()) dispatch(actions.hideModal())
if (customOnHideOpts.action) {
dispatch(customOnHideOpts.action(...customOnHideOpts.args))
}
}, },
hideWarning: () => { hideWarning: () => {
dispatch(actions.hideWarning()) dispatch(actions.hideWarning())
@ -425,7 +433,7 @@ Modal.prototype.render = function () {
if (modal.onHide) { if (modal.onHide) {
modal.onHide(this.props) modal.onHide(this.props)
} }
this.onHide() this.onHide(modal.customOnHideOpts)
}, },
ref: (ref) => { ref: (ref) => {
this.modalRef = ref this.modalRef = ref
@ -447,11 +455,11 @@ Modal.prototype.componentWillReceiveProps = function (nextProps) {
} }
} }
Modal.prototype.onHide = function () { Modal.prototype.onHide = function (customOnHideOpts) {
if (this.props.onHideCallback) { if (this.props.onHideCallback) {
this.props.onHideCallback() this.props.onHideCallback()
} }
this.props.hideModal() this.props.hideModal(customOnHideOpts)
} }
Modal.prototype.hide = function () { Modal.prototype.hide = function () {