From f5fbaa3b544038caa76cd8382af2a9c990f80a4f 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 --- packages/docsearch-react/src/DocSearchModal.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/docsearch-react/src/DocSearchModal.tsx b/packages/docsearch-react/src/DocSearchModal.tsx index 668a76a41..9a6c47cab 100644 --- a/packages/docsearch-react/src/DocSearchModal.tsx +++ b/packages/docsearch-react/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,