Skip to content

Commit

Permalink
Validator search now ignore spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mraveux committed Oct 8, 2024
1 parent 765106f commit 271731d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/prestaking/PrestakingValidatorPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,12 @@ export default defineComponent({
return 'label' in validator;
}
return [
('label' in validator ? validator.label : '').toLowerCase(),
validator.address.toLowerCase(),
].join('').includes(searchValue.value.toLowerCase());
const searchTerm = searchValue.value.toLowerCase().replace(/\s+/g, '');
const validatorLabel = ('label' in validator ? validator.label : '')
.toLowerCase().replace(/\s+/g, '');
const validatorAddress = validator.address.toLowerCase().replace(/\s+/g, '');
return validatorLabel.includes(searchTerm) || validatorAddress.includes(searchTerm);
})
.sort((a, b) => {
const cmp = (a.stake ? a.stake : 0) - (b.stake ? b.stake : 0);
Expand Down

0 comments on commit 271731d

Please sign in to comment.