From 03f53df3f372ef9df8d9ddfee96952265fc76bac Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Tue, 3 Dec 2019 23:25:00 -0330 Subject: [PATCH] Updates to account search functionality (#7637) --- app/scripts/controllers/permissions/index.js | 2 +- .../components/app/account-menu/account-menu.component.js | 2 +- .../components/app/account-menu/account-menu.container.js | 7 ++++--- ui/app/selectors/selectors.js | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/scripts/controllers/permissions/index.js b/app/scripts/controllers/permissions/index.js index de1c472e4..4a5b82cae 100644 --- a/app/scripts/controllers/permissions/index.js +++ b/app/scripts/controllers/permissions/index.js @@ -188,7 +188,7 @@ class PermissionsController { let error try { await new Promise((resolve, reject) => { - this.permissions.grantNewPermissions(origin, permissions, {}, err => err ? resolve() : reject(err)) + this.permissions.grantNewPermissions(origin, permissions, {}, err => (err ? resolve() : reject(err))) }) } catch (err) { error = err diff --git a/ui/app/components/app/account-menu/account-menu.component.js b/ui/app/components/app/account-menu/account-menu.component.js index 1a7bdf87f..f5217606f 100644 --- a/ui/app/components/app/account-menu/account-menu.component.js +++ b/ui/app/components/app/account-menu/account-menu.component.js @@ -264,7 +264,7 @@ export default class AccountMenu extends Component { const shouldShowScrollButton = canScroll && !atAccountListBottom - this.setState({ shouldShowScrollButton}) + this.setState({ shouldShowScrollButton }) } onScroll = debounce(this.setShouldShowScrollButton, 25) diff --git a/ui/app/components/app/account-menu/account-menu.container.js b/ui/app/components/app/account-menu/account-menu.container.js index 2823a474d..7182550a5 100644 --- a/ui/app/components/app/account-menu/account-menu.container.js +++ b/ui/app/components/app/account-menu/account-menu.container.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux' -import { compose, withProps } from 'recompose' +import { compose } from 'recompose' import { withRouter } from 'react-router-dom' import { toggleAccountMenu, @@ -27,6 +27,7 @@ const SHOW_SEARCH_ACCOUNTS_MIN_COUNT = 5 function mapStateToProps (state) { const { metamask: { isAccountMenuOpen } } = state + const accounts = getMetaMaskAccountsOrdered(state) return { isAccountMenuOpen, @@ -34,7 +35,8 @@ function mapStateToProps (state) { originOfCurrentTab: getOriginOfCurrentTab(state), selectedAddress: getSelectedAddress(state), keyrings: getMetaMaskKeyrings(state), - accounts: getMetaMaskAccountsOrdered(state), + accounts, + shouldShowAccountsSearch: accounts.length >= SHOW_SEARCH_ACCOUNTS_MIN_COUNT, } } @@ -71,5 +73,4 @@ function mapDispatchToProps (dispatch) { export default compose( withRouter, connect(mapStateToProps, mapDispatchToProps), - withProps(({ accounts }) => ({ shouldShowAccountsSearch: accounts.length >= SHOW_SEARCH_ACCOUNTS_MIN_COUNT})) )(AccountMenu) diff --git a/ui/app/selectors/selectors.js b/ui/app/selectors/selectors.js index 3077421ac..7c91ea770 100644 --- a/ui/app/selectors/selectors.js +++ b/ui/app/selectors/selectors.js @@ -131,7 +131,7 @@ export const getMetaMaskAccountsOrdered = createSelector( (keyrings, identities, accounts) => keyrings .reduce((list, keyring) => list.concat(keyring.accounts), []) .filter(address => !!identities[address]) - .map(address => ({ ...identities[address], ...accounts[address]})) + .map(address => ({ ...identities[address], ...accounts[address] })) ) export function isBalanceCached (state) {