1
0
Fork 0

fix(docsearch): add index name to localStorage key

This commit is contained in:
François Chalifour 2020-04-24 17:10:26 +02:00
parent 8ca44b53b2
commit 294c7cf221

View file

@ -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,