diff options
author | Alexander Tseung <alextsg@users.noreply.github.com> | 2018-03-09 23:31:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-09 23:31:53 +0800 |
commit | ab1b39f5543aa9d1ea8eb8d35e29f832f782df7c (patch) | |
tree | 9d9cc074c7424db23267b9820bbaf73498c7bbdf /ui/app | |
parent | d84341f323505e3dec4b13a200e6022747fa58fc (diff) | |
download | tangerine-wallet-browser-ab1b39f5543aa9d1ea8eb8d35e29f832f782df7c.tar tangerine-wallet-browser-ab1b39f5543aa9d1ea8eb8d35e29f832f782df7c.tar.gz tangerine-wallet-browser-ab1b39f5543aa9d1ea8eb8d35e29f832f782df7c.tar.bz2 tangerine-wallet-browser-ab1b39f5543aa9d1ea8eb8d35e29f832f782df7c.tar.lz tangerine-wallet-browser-ab1b39f5543aa9d1ea8eb8d35e29f832f782df7c.tar.xz tangerine-wallet-browser-ab1b39f5543aa9d1ea8eb8d35e29f832f782df7c.tar.zst tangerine-wallet-browser-ab1b39f5543aa9d1ea8eb8d35e29f832f782df7c.zip |
Remove de-selected token from selectedTokens hash instead of setting to null (#3494)
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/add-token.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/ui/app/add-token.js b/ui/app/add-token.js index 51c577987..b8878b772 100644 --- a/ui/app/add-token.js +++ b/ui/app/add-token.js @@ -71,13 +71,17 @@ AddTokenScreen.prototype.componentWillMount = function () { } AddTokenScreen.prototype.toggleToken = function (address, token) { - const { selectedTokens, errors } = this.state - const { [address]: selectedToken } = selectedTokens + const { selectedTokens = {}, errors } = this.state + const selectedTokensCopy = { ...selectedTokens } + + if (address in selectedTokensCopy) { + delete selectedTokensCopy[address] + } else { + selectedTokensCopy[address] = token + } + this.setState({ - selectedTokens: { - ...selectedTokens, - [address]: selectedToken ? null : token, - }, + selectedTokens: selectedTokensCopy, errors: { ...errors, tokenSelector: null, |