1
0
Fork 0

feat(docsearch): display more recent searches when no favorites

This commit is contained in:
François Chalifour 2020-04-03 18:42:37 +02:00
parent 44558ec1f9
commit 164a0ce8f0

View file

@ -57,7 +57,9 @@ export function DocSearch({
const recentSearches = React.useRef(
createStoredSearches<StoredDocSearchHit>({
key: '__DOCSEARCH_RECENT_SEARCHES__',
limit: 5,
// We display 7 recent searches and there's no favorites, but only
// 4 when there are favorites.
limit: favoriteSearches.getAll().length === 0 ? 7 : 4,
})
).current;