Skip to content

Commit b6b42ce

Browse files
committed
Fix AltStore memleak bitshares/bitshares-ui#1497
1 parent 0677ac2 commit b6b42ce

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/store/AltStore.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,13 @@ class AltStore {
9999

100100
unlisten(cb) {
101101
this.lifecycle('unlisten')
102-
this.subscriptions
103-
.filter(subscription => subscription.cb === cb)
104-
.forEach(subscription => subscription.dispose())
102+
this.subscriptions = this.subscriptions.filter(subscription => {
103+
if (subscription.cb === cb) {
104+
subscription.dispose()
105+
return false
106+
}
107+
return true
108+
})
105109
}
106110

107111
getState() {

0 commit comments

Comments
 (0)