fix(autocomplete): Prioritize exact matches (#3760)
This commit is contained in:
parent
3660e2c481
commit
3d04ba26a3
1 changed files with 1 additions and 1 deletions
|
|
@ -332,7 +332,7 @@ export function Autocomplete(props: {
|
||||||
const currentFilter = filter()
|
const currentFilter = filter()
|
||||||
if (!currentFilter) return mixed.slice(0, 10)
|
if (!currentFilter) return mixed.slice(0, 10)
|
||||||
const result = fuzzysort.go(currentFilter, mixed, {
|
const result = fuzzysort.go(currentFilter, mixed, {
|
||||||
keys: ["display", "description", (obj) => obj.aliases?.join(" ") ?? ""],
|
keys: [(obj) => obj.display.trimEnd(), "description", (obj) => obj.aliases?.join(" ") ?? ""],
|
||||||
limit: 10,
|
limit: 10,
|
||||||
})
|
})
|
||||||
return result.map((arr) => arr.obj)
|
return result.map((arr) => arr.obj)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue