diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-06-19 09:08:38 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-06-19 09:08:38 +0800 |
commit | 031e7d270d8155e2f79875fb5366a7a7475b1291 (patch) | |
tree | 601c447820909a42e2536590f0d93358acd004d5 /packages | |
parent | 49f5495c459f194f3cab6ff24526da924bd64a53 (diff) | |
download | dexon-sol-tools-031e7d270d8155e2f79875fb5366a7a7475b1291.tar dexon-sol-tools-031e7d270d8155e2f79875fb5366a7a7475b1291.tar.gz dexon-sol-tools-031e7d270d8155e2f79875fb5366a7a7475b1291.tar.bz2 dexon-sol-tools-031e7d270d8155e2f79875fb5366a7a7475b1291.tar.lz dexon-sol-tools-031e7d270d8155e2f79875fb5366a7a7475b1291.tar.xz dexon-sol-tools-031e7d270d8155e2f79875fb5366a7a7475b1291.tar.zst dexon-sol-tools-031e7d270d8155e2f79875fb5366a7a7475b1291.zip |
Fix bug where we do fetch balances on wallet login
Diffstat (limited to 'packages')
-rw-r--r-- | packages/website/ts/components/portal/portal.tsx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx index 28a303793..8de5a62ec 100644 --- a/packages/website/ts/components/portal/portal.tsx +++ b/packages/website/ts/components/portal/portal.tsx @@ -155,9 +155,6 @@ export class Portal extends React.Component<PortalProps, PortalState> { } public componentWillMount(): void { this._blockchain = new Blockchain(this.props.dispatcher); - const trackedTokenAddresses = _.keys(this.state.trackedTokenStateByAddress); - // tslint:disable-next-line:no-floating-promises - this._fetchBalancesAndAllowancesAsync(trackedTokenAddresses); } public componentWillUnmount(): void { this._blockchain.destroy(); @@ -168,6 +165,13 @@ export class Portal extends React.Component<PortalProps, PortalState> { // become disconnected from their backing Ethereum node, changed user accounts, etc...) this.props.dispatcher.resetState(); } + public componentDidUpdate(prevProps: PortalProps): void { + if (!prevProps.blockchainIsLoaded && this.props.blockchainIsLoaded) { + // tslint:disable-next-line:no-floating-promises + const trackedTokenAddresses = _.keys(this.state.trackedTokenStateByAddress); + this._fetchBalancesAndAllowancesAsync(trackedTokenAddresses); + } + } public componentWillReceiveProps(nextProps: PortalProps): void { if (nextProps.networkId !== this.state.prevNetworkId) { // tslint:disable-next-line:no-floating-promises |