diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-10 07:40:13 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-10 07:40:13 +0800 |
commit | 4072076965fba42ee02b689db1e97d9a970620f4 (patch) | |
tree | 017bdc274533a6255761ef54d9dc8b2e7c59d62f | |
parent | 93054ae52b782a7085c482e2510e77ae8bb03520 (diff) | |
download | dexon-sol-tools-4072076965fba42ee02b689db1e97d9a970620f4.tar dexon-sol-tools-4072076965fba42ee02b689db1e97d9a970620f4.tar.gz dexon-sol-tools-4072076965fba42ee02b689db1e97d9a970620f4.tar.bz2 dexon-sol-tools-4072076965fba42ee02b689db1e97d9a970620f4.tar.lz dexon-sol-tools-4072076965fba42ee02b689db1e97d9a970620f4.tar.xz dexon-sol-tools-4072076965fba42ee02b689db1e97d9a970620f4.tar.zst dexon-sol-tools-4072076965fba42ee02b689db1e97d9a970620f4.zip |
Don't start heartbeat if no account
-rw-r--r-- | packages/instant/src/components/zero_ex_instant_provider.tsx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/instant/src/components/zero_ex_instant_provider.tsx b/packages/instant/src/components/zero_ex_instant_provider.tsx index 1223b477e..fbe0e977f 100644 --- a/packages/instant/src/components/zero_ex_instant_provider.tsx +++ b/packages/instant/src/components/zero_ex_instant_provider.tsx @@ -11,7 +11,7 @@ import { asyncData } from '../redux/async_data'; import { DEFAULT_STATE, DefaultState, State } from '../redux/reducer'; import { store, Store } from '../redux/store'; import { fonts } from '../style/fonts'; -import { AffiliateInfo, AssetMetaData, Network, OrderSource } from '../types'; +import { AffiliateInfo, AssetMetaData, Network, OrderSource, AccountState } from '../types'; import { assetUtils } from '../util/asset'; import { errorFlasher } from '../util/error_flasher'; import { gasPriceEstimator } from '../util/gas_price_estimator'; @@ -99,11 +99,13 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider asyncData.fetchAvailableAssetDatasAndDispatchToStore(this._store); } - this._accountUpdateHeartbeat = generateAccountHeartbeater({ - store: this._store, - shouldPerformImmediatelyOnStart: true, - }); - this._accountUpdateHeartbeat.start(ACCOUNT_UPDATE_INTERVAL_TIME_MS); + if (state.providerState.account.state !== AccountState.None) { + this._accountUpdateHeartbeat = generateAccountHeartbeater({ + store: this._store, + shouldPerformImmediatelyOnStart: true, + }); + this._accountUpdateHeartbeat.start(ACCOUNT_UPDATE_INTERVAL_TIME_MS); + } this._buyQuoteHeartbeat = generateBuyQuoteHeartbeater({ store: this._store, |