From f5e119274109878bc5933881a42b3fc2abb46c2e Mon Sep 17 00:00:00 2001 From: nivida Date: Thu, 28 Nov 2019 09:45:39 +0100 Subject: [PATCH 1/2] missing check added to requestManager.clearSubscriptions --- packages/web3-core-requestmanager/src/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/web3-core-requestmanager/src/index.js b/packages/web3-core-requestmanager/src/index.js index 4fc48d493c7..4bff56b5ea3 100644 --- a/packages/web3-core-requestmanager/src/index.js +++ b/packages/web3-core-requestmanager/src/index.js @@ -228,11 +228,13 @@ RequestManager.prototype.clearSubscriptions = function (keepIsSyncing) { var _this = this; - // uninstall all subscriptions - Object.keys(this.subscriptions).forEach(function(id){ - if(!keepIsSyncing || _this.subscriptions[id].name !== 'syncing') - _this.removeSubscription(id); - }); + if (this.subscriptions) { + // uninstall all subscriptions + Object.keys(this.subscriptions).forEach(function(id){ + if(!keepIsSyncing || _this.subscriptions[id].name !== 'syncing') + _this.removeSubscription(id); + }); + } // reset notification callbacks etc. From 0b2ca31111977072a829b7de9cce3ae72065f1d8 Mon Sep 17 00:00:00 2001 From: nivida Date: Thu, 28 Nov 2019 10:08:02 +0100 Subject: [PATCH 2/2] CHANGELOG.md updated --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91679178aef..eae6e5b9094 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -109,3 +109,5 @@ Released with 1.0.0-beta.37 code base. - ``getPendingTransactions`` added to web3-eth package (#3239) ### Fixed + +- ``clearSubscriptions`` does no longer throw an error if no running subscriptions do exist (#3246)