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

Remove TokenTracker listeners when unmounting component

This commit is contained in:
Whymarrh Whitby 2018-07-05 10:24:01 -02:30
parent 46cda26f3b
commit 0116ea9b95
2 changed files with 4 additions and 0 deletions

View File

@ -110,5 +110,7 @@ TokenBalance.prototype.updateBalance = function (tokens = []) {
TokenBalance.prototype.componentWillUnmount = function () {
if (!this.tracker) return
this.tracker.stop()
this.tracker.removeListener('update', this.balanceUpdater)
this.tracker.removeListener('error', this.showError)
}

View File

@ -164,6 +164,8 @@ TokenList.prototype.updateBalances = function (tokens) {
TokenList.prototype.componentWillUnmount = function () {
if (!this.tracker) return
this.tracker.stop()
this.tracker.removeListener('update', this.balanceUpdater)
this.tracker.removeListener('error', this.showError)
}
// function uniqueMergeTokens (tokensA, tokensB = []) {