aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts
diff options
context:
space:
mode:
authorBrandon Millman <brandon@0xproject.com>2018-10-23 04:49:52 +0800
committerGitHub <noreply@github.com>2018-10-23 04:49:52 +0800
commit19f9649e74f487714f7094e013480f7b8e81090c (patch)
treea7efd6359332063412dd6cb919640d6bb3ec057a /packages/website/ts
parent2c308c0f4c172293e634d27f731d026e0361e639 (diff)
parent1a3b1607b12cd75a1fc12ecd504dad61bef8d291 (diff)
downloaddexon-sol-tools-19f9649e74f487714f7094e013480f7b8e81090c.tar
dexon-sol-tools-19f9649e74f487714f7094e013480f7b8e81090c.tar.gz
dexon-sol-tools-19f9649e74f487714f7094e013480f7b8e81090c.tar.bz2
dexon-sol-tools-19f9649e74f487714f7094e013480f7b8e81090c.tar.lz
dexon-sol-tools-19f9649e74f487714f7094e013480f7b8e81090c.tar.xz
dexon-sol-tools-19f9649e74f487714f7094e013480f7b8e81090c.tar.zst
dexon-sol-tools-19f9649e74f487714f7094e013480f7b8e81090c.zip
Merge pull request #1174 from 0xProject/fix/website/kovan
[website] Fix broken order signing on portal and broken loading on kovan
Diffstat (limited to 'packages/website/ts')
-rw-r--r--packages/website/ts/blockchain.ts2
-rw-r--r--packages/website/ts/components/portal/portal.tsx19
2 files changed, 14 insertions, 7 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index efb5aef23..62e16dd1d 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -163,7 +163,7 @@ export class Blockchain {
const providerName = this._getNameGivenProvider(injectedWeb3.currentProvider);
// Wrap Metamask in a compatability wrapper MetamaskSubprovider (to handle inconsistencies)
const signerSubprovider =
- providerName === Providers.Metamask
+ providerName === constants.PROVIDER_NAME_METAMASK
? new MetamaskSubprovider(injectedWeb3.currentProvider)
: new SignerSubprovider(injectedWeb3.currentProvider);
provider.addProvider(signerSubprovider);
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(