forked from MapComplete/MapComplete
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:
parent
8d8b34dafc
commit
440d4fbeb8
3 changed files with 34 additions and 4 deletions
|
|
@ -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]
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue