diff options
author | Dan <danjm.com@gmail.com> | 2017-10-24 23:26:42 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-10-25 07:31:04 +0800 |
commit | ef2b0d848582788c6cf69a11e17a12358bb2aa7b (patch) | |
tree | d3ef7b29c6c8a8af7b6561e8e1a24aa5f30c46ce /ui | |
parent | 07c4c92db64ffaaefbb9eb661d24bbb4c8c5ddb6 (diff) | |
download | tangerine-wallet-browser-ef2b0d848582788c6cf69a11e17a12358bb2aa7b.tar tangerine-wallet-browser-ef2b0d848582788c6cf69a11e17a12358bb2aa7b.tar.gz tangerine-wallet-browser-ef2b0d848582788c6cf69a11e17a12358bb2aa7b.tar.bz2 tangerine-wallet-browser-ef2b0d848582788c6cf69a11e17a12358bb2aa7b.tar.lz tangerine-wallet-browser-ef2b0d848582788c6cf69a11e17a12358bb2aa7b.tar.xz tangerine-wallet-browser-ef2b0d848582788c6cf69a11e17a12358bb2aa7b.tar.zst tangerine-wallet-browser-ef2b0d848582788c6cf69a11e17a12358bb2aa7b.zip |
Simply logic for rendering matching accounts in to-autocomplete dropdown.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/components/send/to-autocomplete.js | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/ui/app/components/send/to-autocomplete.js b/ui/app/components/send/to-autocomplete.js index 081b85ab7..ab490155b 100644 --- a/ui/app/components/send/to-autocomplete.js +++ b/ui/app/components/send/to-autocomplete.js @@ -62,26 +62,18 @@ ToAutoComplete.prototype.handleInputEvent = function (event = {}, cb) { openDropdown, } = this.props - const matchingAccounts = accounts.filter(({ address }) => address.match(to)) + const matchingAccounts = accounts.filter(({ address }) => address.match(to || '')) + const matches = matchingAccounts.length - if (!to) { - this.setState({ accountsToRender: accounts }) - openDropdown() - } - else if (matchingAccounts.length === 1 && matchingAccounts[0].address === to) { + if (!matches || matchingAccounts[0].address === to) { this.setState({ accountsToRender: [] }) event.target && event.target.select() closeDropdown() } - else if (matchingAccounts.length) { + else { this.setState({ accountsToRender: matchingAccounts }) openDropdown() } - else { - this.setState({ accountsToRender: [] }) - event.target && event.target.select() - closeDropdown() - } cb && cb(event.target.value) } |