1
0
Fork 0

feat(docsearch): display 5 hits per category maximum

This commit is contained in:
François Chalifour 2020-06-05 14:44:55 +02:00
parent 9eaf18a81f
commit e5896579be

View file

@ -9,7 +9,11 @@ export function groupBy<TValue extends object>(
acc[key] = [];
}
acc[key].push(item);
// We limit each section to show 5 hits maximum.
// This acts as a frontend alternative to `distinct`.
if (acc[key].length < 5) {
acc[key].push(item);
}
return acc;
}, {});