Merge pull request #4734 from whymarrh/txlistitem-setstate-warning

Prevent calling setState in TxListItem after unmount
This commit is contained in:
Whymarrh Whitby 2018-07-05 13:59:25 -02:30 committed by GitHub
commit e59e92e028
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -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,