diff options
author | Fabio Berger <me@fabioberger.com> | 2018-01-30 18:15:36 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-01-30 18:15:36 +0800 |
commit | c0facfc28f65495a52f9405613fe4a08aff5d164 (patch) | |
tree | a216ce9f7464296293554aa37138d8d33ff945ad /packages/website/ts/blockchain.ts | |
parent | bb0cedd2de44a0b6533df37133ae6f576ee84b2a (diff) | |
download | dexon-sol-tools-c0facfc28f65495a52f9405613fe4a08aff5d164.tar.gz dexon-sol-tools-c0facfc28f65495a52f9405613fe4a08aff5d164.tar.zst dexon-sol-tools-c0facfc28f65495a52f9405613fe4a08aff5d164.zip |
Call destroy ealier so that web3Wrapper stops polling for userAddress/networkId updates before we prep for the batchDispatch
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r-- | packages/website/ts/blockchain.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index fd8d536ed..aba438e8d 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -199,6 +199,8 @@ export class Blockchain { this._cachedProviderNetworkId = this.networkId; } + this._web3Wrapper.destroy(); + this._userAddress = ''; this._dispatcher.updateUserAddress(''); // Clear old userAddress @@ -212,7 +214,6 @@ export class Blockchain { provider.addProvider(new FilterSubprovider()); provider.addProvider(new RedundantRPCSubprovider(configs.PUBLIC_NODE_URLS_BY_NETWORK_ID[networkId])); provider.start(); - this._web3Wrapper.destroy(); this.networkId = networkId; this._dispatcher.updateNetworkId(this.networkId); const shouldPollUserAddress = false; @@ -228,10 +229,12 @@ export class Blockchain { if (_.isUndefined(this._cachedProvider)) { return; // Going from injected to injected, so we noop } + + this._web3Wrapper.destroy(); + const provider = this._cachedProvider; this.networkId = this._cachedProviderNetworkId; - this._web3Wrapper.destroy(); const shouldPollUserAddress = true; this._web3Wrapper = new Web3Wrapper(this._dispatcher, provider, this.networkId, shouldPollUserAddress); |