Don't try to match with an empty query string

This was causing UserProvider to give results because every string happens to start with empty string and its regex also acepts the empty string.
This commit is contained in:
Luke Barnard 2017-07-04 17:32:07 +01:00
parent 0af77e8913
commit 710ee69418

View File

@ -86,6 +86,9 @@ export default class QueryMatcher {
if (this.options.shouldMatchWordsOnly) {
query = query.replace(/[^\w]/g, '');
}
if (query.length === 0) {
return [];
}
const results = [];
this.keyMap.keys.forEach((key) => {
let resultKey = key.toLowerCase();