mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
Remove de-selected token from selectedTokens hash instead of setting to null (#3494)
This commit is contained in:
parent
d84341f323
commit
ab1b39f554
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user