Prevent calling setState in TxListItem after unmount

feature/default_network_editable
Whymarrh Whitby 6 years ago
parent 46cda26f3b
commit 2298daa53e
  1. 9
      ui/app/components/tx-list-item.js

@ -54,6 +54,8 @@ function TxListItem () {
fiatTotal: null,
isTokenTx: null,
}
this.unmounted = false
}
TxListItem.prototype.componentDidMount = async function () {
@ -67,9 +69,16 @@ TxListItem.prototype.componentDidMount = async function () {
? await this.getSendTokenTotal()
: this.getSendEtherTotal()
if (this.unmounted) {
return
}
this.setState({ total, fiatTotal, isTokenTx })
}
TxListItem.prototype.componentWillUnmount = function () {
this.unmounted = true
}
TxListItem.prototype.getAddressText = function () {
const {
address,

Loading…
Cancel
Save