fix(spotlight): rank results before dedupe
This commit is contained in:
1 parent
2b9aa0fdf1
commit
65f0881504
1 file changed
+11
-8
@@ -45,15 +45,18 @@ export const SpotlightGroupActions = <TOption extends Record<string, unknown>>({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const filteredOptions = getUniqueOptions(options, group.keyPath)
|
const filteredOptions = getUniqueOptions(
|
||||||
.filter((option) => ("filter" in group ? group.filter(query, option) : false))
|
options
|
||||||
.sort((optionA, optionB) => {
|
.filter((option) => ("filter" in group ? group.filter(query, option) : false))
|
||||||
if ("sort" in group) {
|
.sort((optionA, optionB) => {
|
||||||
return group.sort?.(query, [optionA, optionB]) ?? 0;
|
if ("sort" in group) {
|
||||||
}
|
return group.sort?.(query, [optionA, optionB]) ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
});
|
}),
|
||||||
|
group.keyPath,
|
||||||
|
);
|
||||||
|
|
||||||
if (filteredOptions.length === 0) {
|
if (filteredOptions.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in new issue
Block a user