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

Prevent calling setState in TxListItem after unmount

This commit is contained in:
Whymarrh Whitby 2018-07-05 12:09:33 -02:30
parent 46cda26f3b
commit 2298daa53e

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,