aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/portal/portal.tsx
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-24 08:15:23 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-24 08:15:23 +0800
commit3cd9f40e63d82c983ce10963c62432c87808f993 (patch)
tree471b1aa39da8ee36f27e6d21978a8cd1c52cf048 /packages/website/ts/components/portal/portal.tsx
parenta766d78706cb45336263388360584390fe0e62f2 (diff)
parent4a72dc6c6f0825232d61e470f5b7975aec2e5c0e (diff)
downloaddexon-sol-tools-3cd9f40e63d82c983ce10963c62432c87808f993.tar
dexon-sol-tools-3cd9f40e63d82c983ce10963c62432c87808f993.tar.gz
dexon-sol-tools-3cd9f40e63d82c983ce10963c62432c87808f993.tar.bz2
dexon-sol-tools-3cd9f40e63d82c983ce10963c62432c87808f993.tar.lz
dexon-sol-tools-3cd9f40e63d82c983ce10963c62432c87808f993.tar.xz
dexon-sol-tools-3cd9f40e63d82c983ce10963c62432c87808f993.tar.zst
dexon-sol-tools-3cd9f40e63d82c983ce10963c62432c87808f993.zip
Merge branch 'development' into feature/instant/failure-state
Diffstat (limited to 'packages/website/ts/components/portal/portal.tsx')
-rw-r--r--packages/website/ts/components/portal/portal.tsx19
1 files changed, 13 insertions, 6 deletions
diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx
index 2299881c4..94ab63ac6 100644
--- a/packages/website/ts/components/portal/portal.tsx
+++ b/packages/website/ts/components/portal/portal.tsx
@@ -210,12 +210,16 @@ export class Portal extends React.Component<PortalProps, PortalState> {
isLoaded: false,
};
}
- this.setState({
- trackedTokenStateByAddress,
- });
- // Fetch the actual balance/allowance.
- // tslint:disable-next-line:no-floating-promises
- this._fetchBalancesAndAllowancesAsync(newTokenAddresses);
+ this.setState(
+ {
+ trackedTokenStateByAddress,
+ },
+ () => {
+ // Fetch the actual balance/allowance.
+ // tslint:disable-next-line:no-floating-promises
+ this._fetchBalancesAndAllowancesAsync(newTokenAddresses);
+ },
+ );
}
}
public render(): React.ReactNode {
@@ -644,6 +648,9 @@ export class Portal extends React.Component<PortalProps, PortalState> {
}
private async _fetchBalancesAndAllowancesAsync(tokenAddresses: string[]): Promise<void> {
+ if (_.isEmpty(tokenAddresses)) {
+ return;
+ }
const trackedTokenStateByAddress = this.state.trackedTokenStateByAddress;
const userAddressIfExists = _.isEmpty(this.props.userAddress) ? undefined : this.props.userAddress;
const balancesAndAllowances = await Promise.all(