Updates to account search functionality (#7637)

feature/default_network_editable
Whymarrh Whitby 5 years ago committed by GitHub
parent 2d6ad7f6ca
commit 03f53df3f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/scripts/controllers/permissions/index.js
  2. 2
      ui/app/components/app/account-menu/account-menu.component.js
  3. 7
      ui/app/components/app/account-menu/account-menu.container.js
  4. 2
      ui/app/selectors/selectors.js

@ -188,7 +188,7 @@ class PermissionsController {
let error let error
try { try {
await new Promise((resolve, reject) => { 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) { } catch (err) {
error = err error = err

@ -264,7 +264,7 @@ export default class AccountMenu extends Component {
const shouldShowScrollButton = canScroll && !atAccountListBottom const shouldShowScrollButton = canScroll && !atAccountListBottom
this.setState({ shouldShowScrollButton}) this.setState({ shouldShowScrollButton })
} }
onScroll = debounce(this.setShouldShowScrollButton, 25) onScroll = debounce(this.setShouldShowScrollButton, 25)

@ -1,5 +1,5 @@
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { compose, withProps } from 'recompose' import { compose } from 'recompose'
import { withRouter } from 'react-router-dom' import { withRouter } from 'react-router-dom'
import { import {
toggleAccountMenu, toggleAccountMenu,
@ -27,6 +27,7 @@ const SHOW_SEARCH_ACCOUNTS_MIN_COUNT = 5
function mapStateToProps (state) { function mapStateToProps (state) {
const { metamask: { isAccountMenuOpen } } = state const { metamask: { isAccountMenuOpen } } = state
const accounts = getMetaMaskAccountsOrdered(state)
return { return {
isAccountMenuOpen, isAccountMenuOpen,
@ -34,7 +35,8 @@ function mapStateToProps (state) {
originOfCurrentTab: getOriginOfCurrentTab(state), originOfCurrentTab: getOriginOfCurrentTab(state),
selectedAddress: getSelectedAddress(state), selectedAddress: getSelectedAddress(state),
keyrings: getMetaMaskKeyrings(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( export default compose(
withRouter, withRouter,
connect(mapStateToProps, mapDispatchToProps), connect(mapStateToProps, mapDispatchToProps),
withProps(({ accounts }) => ({ shouldShowAccountsSearch: accounts.length >= SHOW_SEARCH_ACCOUNTS_MIN_COUNT}))
)(AccountMenu) )(AccountMenu)

@ -131,7 +131,7 @@ export const getMetaMaskAccountsOrdered = createSelector(
(keyrings, identities, accounts) => keyrings (keyrings, identities, accounts) => keyrings
.reduce((list, keyring) => list.concat(keyring.accounts), []) .reduce((list, keyring) => list.concat(keyring.accounts), [])
.filter(address => !!identities[address]) .filter(address => !!identities[address])
.map(address => ({ ...identities[address], ...accounts[address]})) .map(address => ({ ...identities[address], ...accounts[address] }))
) )
export function isBalanceCached (state) { export function isBalanceCached (state) {

Loading…
Cancel
Save