aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-27 04:58:31 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-27 04:58:31 +0800
commit5e38cbd69c087e827ee4f4bec69b8e07103e46b8 (patch)
treebe3c8770acf438a076cfbf0321c3f019a3e5f171 /packages/website/ts
parent26edec57732185da1d3de52f4a0e9184196eb0a5 (diff)
downloaddexon-sol-tools-5e38cbd69c087e827ee4f4bec69b8e07103e46b8.tar
dexon-sol-tools-5e38cbd69c087e827ee4f4bec69b8e07103e46b8.tar.gz
dexon-sol-tools-5e38cbd69c087e827ee4f4bec69b8e07103e46b8.tar.bz2
dexon-sol-tools-5e38cbd69c087e827ee4f4bec69b8e07103e46b8.tar.lz
dexon-sol-tools-5e38cbd69c087e827ee4f4bec69b8e07103e46b8.tar.xz
dexon-sol-tools-5e38cbd69c087e827ee4f4bec69b8e07103e46b8.tar.zst
dexon-sol-tools-5e38cbd69c087e827ee4f4bec69b8e07103e46b8.zip
Never use trackedTokenState when fetching new token state
Diffstat (limited to 'packages/website/ts')
-rw-r--r--packages/website/ts/components/portal/portal.tsx11
1 files changed, 5 insertions, 6 deletions
diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx
index df313415d..f06035f3f 100644
--- a/packages/website/ts/components/portal/portal.tsx
+++ b/packages/website/ts/components/portal/portal.tsx
@@ -152,9 +152,8 @@ export class Portal extends React.Component<PortalProps, PortalState> {
}
public componentDidUpdate(prevProps: PortalProps): void {
if (!prevProps.blockchainIsLoaded && this.props.blockchainIsLoaded) {
- const trackedTokenAddresses = _.map(this._getCurrentTrackedTokens(), token => token.address);
// tslint:disable-next-line:no-floating-promises
- this._fetchBalancesAndAllowancesAsync(trackedTokenAddresses);
+ this._fetchBalancesAndAllowancesAsync(this._getCurrentTrackedTokensAddresses());
}
}
public componentWillReceiveProps(nextProps: PortalProps): void {
@@ -188,9 +187,8 @@ export class Portal extends React.Component<PortalProps, PortalState> {
(nextProps.userAddress !== this.props.userAddress && nextProps.networkId === this.props.networkId) ||
nextProps.lastForceTokenStateRefetch !== this.props.lastForceTokenStateRefetch
) {
- const trackedTokenAddresses = _.keys(this.state.trackedTokenStateByAddress);
// tslint:disable-next-line:no-floating-promises
- this._fetchBalancesAndAllowancesAsync(trackedTokenAddresses);
+ this._fetchBalancesAndAllowancesAsync(this._getCurrentTrackedTokensAddresses());
}
const nextTrackedTokens = this._getTrackedTokens(nextProps.tokenByAddress);
@@ -609,11 +607,12 @@ export class Portal extends React.Component<PortalProps, PortalState> {
const isSmallScreen = this.props.screenWidth === ScreenWidths.Sm;
return isSmallScreen;
}
-
private _getCurrentTrackedTokens(): Token[] {
return this._getTrackedTokens(this.props.tokenByAddress);
}
-
+ private _getCurrentTrackedTokensAddresses(): string[] {
+ return _.map(this._getCurrentTrackedTokens(), token => token.address);
+ }
private _getTrackedTokens(tokenByAddress: TokenByAddress): Token[] {
const allTokens = _.values(tokenByAddress);
const trackedTokens = _.filter(allTokens, t => t.isTracked);