From b6b42ceb790ca321402e9add95b9f77af8a7657d Mon Sep 17 00:00:00 2001 From: Sigve Kvalsvik Date: Tue, 9 Oct 2018 11:20:09 +0200 Subject: [PATCH] Fix AltStore memleak https://github.com/bitshares/bitshares-ui/issues/1497 --- src/store/AltStore.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/store/AltStore.js b/src/store/AltStore.js index 66ee738f..a780db0b 100644 --- a/src/store/AltStore.js +++ b/src/store/AltStore.js @@ -99,9 +99,13 @@ class AltStore { unlisten(cb) { this.lifecycle('unlisten') - this.subscriptions - .filter(subscription => subscription.cb === cb) - .forEach(subscription => subscription.dispose()) + this.subscriptions = this.subscriptions.filter(subscription => { + if (subscription.cb === cb) { + subscription.dispose() + return false + } + return true + }) } getState() {