1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00

Remove selectedIdentity prop from wallet view

The selectedIdentity property is computed based on the selectedAddress
which means that using both the selectedAddress and the selectedIdentity
is redundant. In the case of the Array#find call on the set of keyrings,
we wouldn't have a situation where one is included and the other isn't.

This changeset removes the selectedIdentity from the wallet view because
it isn't needed.
This commit is contained in:
Whymarrh Whitby 2018-06-05 12:23:30 -07:00
parent 762695bfd9
commit 665ac860e5

View File

@ -36,7 +36,6 @@ function mapStateToProps (state) {
tokens: state.metamask.tokens,
keyrings: state.metamask.keyrings,
selectedAddress: selectors.getSelectedAddress(state),
selectedIdentity: selectors.getSelectedIdentity(state),
selectedAccount: selectors.getSelectedAccount(state),
selectedTokenAddress: state.metamask.selectedTokenAddress,
}
@ -99,12 +98,12 @@ WalletView.prototype.render = function () {
const {
responsiveDisplayClassname,
selectedAddress,
selectedIdentity,
keyrings,
showAccountDetailModal,
sidebarOpen,
hideSidebar,
history,
identities,
} = this.props
// temporary logs + fake extra wallets
// console.log('walletview, selectedAccount:', selectedAccount)
@ -116,8 +115,7 @@ WalletView.prototype.render = function () {
}
const keyring = keyrings.find((kr) => {
return kr.accounts.includes(selectedAddress) ||
kr.accounts.includes(selectedIdentity.address)
return kr.accounts.includes(selectedAddress)
})
const type = keyring.type
@ -149,7 +147,7 @@ WalletView.prototype.render = function () {
h('span.account-name', {
style: {},
}, [
selectedIdentity.name,
identities[selectedAddress].name,
]),
h('button.btn-clear.wallet-view__details-button.allcaps', this.context.t('details')),