1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Changed accounts fuzzy search threshhold to match all (#14914)

* Changed accounts fuzzy search threshhold to match all

* Changed account search only when there is at least 2 terms

* Fixed linting issue

* Lint fix account menu component
This commit is contained in:
Zachary Belford 2022-06-20 15:35:07 -07:00 committed by GitHub
parent 25739a5fc1
commit 5a1bc94aa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,11 +100,12 @@ export default class AccountMenu extends Component {
};
addressFuse = new Fuse([], {
threshold: 0.45,
threshold: 0.55,
location: 0,
distance: 100,
maxPatternLength: 32,
minMatchCharLength: 1,
ignoreFieldNorm: true,
keys: [
{ name: 'name', weight: 0.5 },
{ name: 'address', weight: 0.5 },
@ -130,6 +131,11 @@ export default class AccountMenu extends Component {
}
renderAccountsSearch() {
const handleChange = (e) => {
const val = e.target.value.length > 1 ? e.target.value : '';
this.setSearchQuery(val);
};
const inputAdornment = (
<InputAdornment
position="start"
@ -149,8 +155,7 @@ export default class AccountMenu extends Component {
id="search-accounts"
placeholder={this.context.t('searchAccounts')}
type="text"
value={this.state.searchQuery}
onChange={(e) => this.setSearchQuery(e.target.value)}
onChange={handleChange}
startAdornment={inputAdornment}
fullWidth
theme="material-white-padded"