Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Commit

Permalink
fix(docsearch): add index name to localStorage key
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Apr 24, 2020
1 parent 032343f commit f5fbaa3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/docsearch-react/src/DocSearchModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ export function DocSearchModal({
const searchClient = useSearchClient(appId, apiKey);
const favoriteSearches = React.useRef(
createStoredSearches<StoredDocSearchHit>({
key: '__DOCSEARCH_FAVORITE_SEARCHES__',
key: `__DOCSEARCH_FAVORITE_SEARCHES__${indexName}`,
limit: 10,
})
).current;
const recentSearches = React.useRef(
createStoredSearches<StoredDocSearchHit>({
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,
Expand Down

0 comments on commit f5fbaa3

Please sign in to comment.