Take user home if an unapproved tx is dropped while they are viewing.

This commit is contained in:
Dan 2018-03-20 15:28:48 -02:30
parent 49e3ada382
commit 3830f49ac5
1 changed files with 18 additions and 0 deletions

View File

@ -40,6 +40,7 @@ function mapStateToProps (state) {
currentCurrency: state.metamask.currentCurrency,
blockGasLimit: state.metamask.currentBlockGasLimit,
computedBalances: state.metamask.computedBalances,
selectedAddressTxList: state.metamask.selectedAddressTxList,
}
}
@ -48,6 +49,23 @@ function ConfirmTxScreen () {
Component.call(this)
}
ConfirmTxScreen.prototype.componentDidUpdate = function (prevProps) {
const {
unapprovedTxs,
network,
selectedAddressTxList,
} = this.props
const { index: prevIndex, unapprovedTxs: prevUnapprovedTxs } = prevProps
const prevUnconfTxList = txHelper(prevUnapprovedTxs, {}, {}, {}, network)
const prevTxData = prevUnconfTxList[prevIndex] || {}
const prevTx = selectedAddressTxList.find(({ id }) => id === prevTxData.id) || {}
const unconfTxList = txHelper(unapprovedTxs, {}, {}, {}, network)
if (prevTx.status === 'dropped' && unconfTxList.length === 0) {
this.goHome({})
}
}
ConfirmTxScreen.prototype.render = function () {
const props = this.props
const {