From 164a0ce8f053f90ec82897caac208847bede9be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Fri, 3 Apr 2020 18:42:37 +0200 Subject: [PATCH] feat(docsearch): display more recent searches when no favorites --- src/DocSearch.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DocSearch.tsx b/src/DocSearch.tsx index 56e1cbbb..83d5baad 100644 --- a/src/DocSearch.tsx +++ b/src/DocSearch.tsx @@ -57,7 +57,9 @@ export function DocSearch({ const recentSearches = React.useRef( createStoredSearches({ 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;