Fix: fix some crashes for people who have used dev at the same time and have the new theme-history

This commit is contained in:
Pieter Vander Vennet 2025-04-08 14:51:35 +02:00
parent 8d8b34dafc
commit 440d4fbeb8
3 changed files with 34 additions and 4 deletions

View file

@ -70,7 +70,17 @@ export default class SearchState {
const themeSearch = ThemeSearchIndex.fromState(state)
this.themeSuggestions = this.searchTerm.mapD(
(query) => themeSearch.data.search(query, 3),
(query) => {
const results = themeSearch.data.search(query, 3)
const deduped: MinimalThemeInformation[] = []
for (const result of results) {
if (deduped.some(th => th.id === result.id)) {
continue
}
deduped.push(result)
}
return deduped
},
[themeSearch]
)