Skip to content

Commit

Permalink
this.state.dropdown.suggestions should point to the sorted list and…
Browse files Browse the repository at this point in the history
… not pre-sorted one
  • Loading branch information
yairEO committed Dec 7, 2024
1 parent 643f79d commit 4acd7ae
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/parts/suggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,13 @@ export default {
? whitelist
: whitelist.filter(item => !this.isTagDuplicate( isObject(item) ? item.value : item )) // don't include tags which have already been added.

this.state.dropdown.suggestions = list;

return hasCustomSort
var filteredList = hasCustomSort
? _sd.sortby(list, niddle)
: list.slice(0, suggestionsCount); // respect "maxItems" dropdown setting

this.state.dropdown.suggestions = filteredList;

return filteredList;
}

niddle = _sd.caseSensitive
Expand Down Expand Up @@ -460,9 +462,12 @@ export default {
this.state.dropdown.suggestions = exactMatchesList.concat(list);

// custom sorting function
return hasCustomSort
var filteredList = hasCustomSort
? _sd.sortby(exactMatchesList.concat(list), niddle)
: exactMatchesList.concat(list).slice(0, suggestionsCount)

this.state.dropdown.suggestions = filteredList;
return filteredList
},

/**
Expand Down

0 comments on commit 4acd7ae

Please sign in to comment.