diff options
author | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-06 15:33:39 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-06 15:36:52 +0800 |
commit | 690ddf5ed75967537aa5513986146c262012832a (patch) | |
tree | 96f5e4dcdfa1b6f6fad68fef29ac6753488d5549 /ui/app | |
parent | bffdde2082a64a78228b58b45778fd7886a0eceb (diff) | |
download | tangerine-wallet-browser-690ddf5ed75967537aa5513986146c262012832a.tar tangerine-wallet-browser-690ddf5ed75967537aa5513986146c262012832a.tar.gz tangerine-wallet-browser-690ddf5ed75967537aa5513986146c262012832a.tar.bz2 tangerine-wallet-browser-690ddf5ed75967537aa5513986146c262012832a.tar.lz tangerine-wallet-browser-690ddf5ed75967537aa5513986146c262012832a.tar.xz tangerine-wallet-browser-690ddf5ed75967537aa5513986146c262012832a.tar.zst tangerine-wallet-browser-690ddf5ed75967537aa5513986146c262012832a.zip |
Fix token list
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/components/token-list.js | 35 | ||||
-rw-r--r-- | ui/app/components/tx-list.js | 4 |
2 files changed, 24 insertions, 15 deletions
diff --git a/ui/app/components/token-list.js b/ui/app/components/token-list.js index 7fe072fac..fea87a733 100644 --- a/ui/app/components/token-list.js +++ b/ui/app/components/token-list.js @@ -45,7 +45,7 @@ TokenList.prototype.render = function () { const { userAddress, network } = this.props if (isLoading) { - return this.message('Loading') + return this.message('Loading Tokens...') } if (error) { @@ -115,22 +115,29 @@ TokenList.prototype.createFreshTokenTracker = function () { }) } -TokenList.prototype.componentWillUpdate = function (nextProps) { - if (nextProps.network === 'loading') return - const oldNet = this.props.network - const newNet = nextProps.network - - if (oldNet && newNet && newNet !== oldNet) { - this.setState({ isLoading: true }) - this.createFreshTokenTracker() - } +TokenList.prototype.componentDidUpdate = function (nextProps) { + const { + network: oldNet, + userAddress: oldAddress, + } = this.props + const { + network: newNet, + userAddress: newAddress, + } = nextProps + + if (newNet === 'loading') return + if (!oldNet || !newNet || !oldAddress || !newAddress) return + if (oldAddress === newAddress && oldNet === newNet) return + + this.setState({ isLoading: true }) + this.createFreshTokenTracker() } TokenList.prototype.updateBalances = function (tokens) { - // const heldTokens = tokens.filter(token => { - // return token.balance !== '0' && token.string !== '0.000' - // }) - this.setState({ tokens: tokens, isLoading: false }) + const heldTokens = tokens.filter(token => { + return token.balance !== '0' && token.string !== '0.000' + }) + this.setState({ tokens: heldTokens, isLoading: false }) } TokenList.prototype.componentWillUnmount = function () { diff --git a/ui/app/components/tx-list.js b/ui/app/components/tx-list.js index b8a18970f..0eb15aa70 100644 --- a/ui/app/components/tx-list.js +++ b/ui/app/components/tx-list.js @@ -65,12 +65,14 @@ TxList.prototype.renderTransactionListItem = function (transaction) { transactionAmount: formatBalance(transaction.txParams.value, 6), } const { - address = '', + address, transactionStatus, transactionAmount, dateString, } = props + if (!address) return null + return h('div', { key: transaction.id, }, [ |