diff options
author | Francesco Agosti <francesco.agosti93@gmail.com> | 2018-06-20 04:43:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-20 04:43:08 +0800 |
commit | be4ea18119d6007cb7f94954c6cb117f30402673 (patch) | |
tree | ae773c62b19d2945c94af8ee042f7fceb8db314d /packages/website | |
parent | da69ddc19b29cfca05d28084b196324e121987ea (diff) | |
parent | d32f0fad1264789baa29d68ccafe8693ed81cea7 (diff) | |
download | dexon-0x-contracts-be4ea18119d6007cb7f94954c6cb117f30402673.tar dexon-0x-contracts-be4ea18119d6007cb7f94954c6cb117f30402673.tar.gz dexon-0x-contracts-be4ea18119d6007cb7f94954c6cb117f30402673.tar.bz2 dexon-0x-contracts-be4ea18119d6007cb7f94954c6cb117f30402673.tar.lz dexon-0x-contracts-be4ea18119d6007cb7f94954c6cb117f30402673.tar.xz dexon-0x-contracts-be4ea18119d6007cb7f94954c6cb117f30402673.tar.zst dexon-0x-contracts-be4ea18119d6007cb7f94954c6cb117f30402673.zip |
Merge pull request #727 from 0xProject/bug/website/fix-fetching-balances-on-wallet-login
Fix bug where we do not fetch balances on wallet login
Diffstat (limited to 'packages/website')
-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 debebb47c..0a8f0094f 100644 --- a/packages/website/ts/components/portal/portal.tsx +++ b/packages/website/ts/components/portal/portal.tsx @@ -157,9 +157,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(); @@ -170,6 +167,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) { + const trackedTokenAddresses = _.keys(this.state.trackedTokenStateByAddress); + // tslint:disable-next-line:no-floating-promises + this._fetchBalancesAndAllowancesAsync(trackedTokenAddresses); + } + } public componentWillReceiveProps(nextProps: PortalProps): void { if (nextProps.networkId !== this.state.prevNetworkId) { // tslint:disable-next-line:no-floating-promises |