From 294c7cf2215ef72c7ffee2fc46cc744ea35966e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Fri, 24 Apr 2020 17:10:26 +0200 Subject: [PATCH] fix(docsearch): add index name to localStorage key --- src/DocSearchModal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DocSearchModal.tsx b/src/DocSearchModal.tsx index 668a76a4..9a6c47ca 100644 --- a/src/DocSearchModal.tsx +++ b/src/DocSearchModal.tsx @@ -69,13 +69,13 @@ export function DocSearchModal({ const searchClient = useSearchClient(appId, apiKey); const favoriteSearches = React.useRef( createStoredSearches({ - key: '__DOCSEARCH_FAVORITE_SEARCHES__', + key: `__DOCSEARCH_FAVORITE_SEARCHES__${indexName}`, limit: 10, }) ).current; const recentSearches = React.useRef( createStoredSearches({ - key: '__DOCSEARCH_RECENT_SEARCHES__', + key: `__DOCSEARCH_RECENT_SEARCHES__${indexName}`, // We display 7 recent searches and there's no favorites, but only // 4 when there are favorites. limit: favoriteSearches.getAll().length === 0 ? 7 : 4,