diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-06-29 02:13:19 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-06-29 02:17:30 +0800 |
commit | e4188f5d4c38e53bf6966a364da41a3aa164b567 (patch) | |
tree | ac24b29f975be088a9d3d391f8a73acc7ad14aba /packages/website/ts/components/portal/portal.tsx | |
parent | 360927ec77d5ea50848f4c1b2c66566542a28d1c (diff) | |
parent | 0fcbd02d50bd564a9c888f247a4b0a565d928cc6 (diff) | |
download | dexon-0x-contracts-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar dexon-0x-contracts-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.gz dexon-0x-contracts-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.bz2 dexon-0x-contracts-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.lz dexon-0x-contracts-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.xz dexon-0x-contracts-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.zst dexon-0x-contracts-e4188f5d4c38e53bf6966a364da41a3aa164b567.zip |
Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/support-new-metamask
Diffstat (limited to 'packages/website/ts/components/portal/portal.tsx')
-rw-r--r-- | packages/website/ts/components/portal/portal.tsx | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx index f06035f3f..438c7b52f 100644 --- a/packages/website/ts/components/portal/portal.tsx +++ b/packages/website/ts/components/portal/portal.tsx @@ -191,7 +191,7 @@ export class Portal extends React.Component<PortalProps, PortalState> { this._fetchBalancesAndAllowancesAsync(this._getCurrentTrackedTokensAddresses()); } - const nextTrackedTokens = this._getTrackedTokens(nextProps.tokenByAddress); + const nextTrackedTokens = utils.getTrackedTokens(nextProps.tokenByAddress); const trackedTokens = this._getCurrentTrackedTokens(); if (!_.isEqual(nextTrackedTokens, trackedTokens)) { @@ -562,9 +562,9 @@ export class Portal extends React.Component<PortalProps, PortalState> { if (this.state.tokenManagementState === TokenManagementState.Remove && !isDefaultTrackedToken) { if (token.isRegistered) { // Remove the token from tracked tokens - const newToken = { + const newToken: Token = { ...token, - isTracked: false, + trackedTimestamp: undefined, }; this.props.dispatcher.updateTokenByAddress([newToken]); } else { @@ -608,17 +608,11 @@ export class Portal extends React.Component<PortalProps, PortalState> { return isSmallScreen; } private _getCurrentTrackedTokens(): Token[] { - return this._getTrackedTokens(this.props.tokenByAddress); + return utils.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); - return trackedTokens; - } - private _getInitialTrackedTokenStateByAddress(trackedTokens: Token[]): TokenStateByAddress { const trackedTokenStateByAddress: TokenStateByAddress = {}; _.each(trackedTokens, token => { |