diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-06-27 02:01:50 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-06-27 02:01:50 +0800 |
commit | f70c1ff009385266d694269c2c4dd0e9fb38dc46 (patch) | |
tree | 3880a973d173c640cc29f08d19a5950b287c2d2d /packages/website/ts/components/portal/portal.tsx | |
parent | c4e2dcafa4bd5f4b905680e2c1b80d6ddb6ab6fb (diff) | |
download | dexon-0x-contracts-f70c1ff009385266d694269c2c4dd0e9fb38dc46.tar.gz dexon-0x-contracts-f70c1ff009385266d694269c2c4dd0e9fb38dc46.tar.zst dexon-0x-contracts-f70c1ff009385266d694269c2c4dd0e9fb38dc46.zip |
Ledger to metamask to ledger working
Diffstat (limited to 'packages/website/ts/components/portal/portal.tsx')
-rw-r--r-- | packages/website/ts/components/portal/portal.tsx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx index 58acb435e..bb88e3824 100644 --- a/packages/website/ts/components/portal/portal.tsx +++ b/packages/website/ts/components/portal/portal.tsx @@ -182,9 +182,10 @@ export class Portal extends React.Component<PortalProps, PortalState> { prevPathname: nextProps.location.pathname, }); } + + // If the address changed, but the network did not, we can just refetch the currently tracked tokens. if ( - nextProps.userAddress !== this.props.userAddress || - nextProps.networkId !== this.props.networkId || + (nextProps.userAddress !== this.props.userAddress && nextProps.networkId === this.props.networkId) || nextProps.lastForceTokenStateRefetch !== this.props.lastForceTokenStateRefetch ) { const trackedTokenAddresses = _.keys(this.state.trackedTokenStateByAddress); @@ -200,7 +201,7 @@ export class Portal extends React.Component<PortalProps, PortalState> { const newTokenAddresses = _.map(newTokens, token => token.address); // Add placeholder entry for this token to the state, since fetching the // balance/allowance is asynchronous - const trackedTokenStateByAddress = this.state.trackedTokenStateByAddress; + const trackedTokenStateByAddress = { ...this.state.trackedTokenStateByAddress }; for (const tokenAddress of newTokenAddresses) { trackedTokenStateByAddress[tokenAddress] = { balance: new BigNumber(0), |