diff --git a/src/Logic/State/SearchState.ts b/src/Logic/State/SearchState.ts index 59b59d9bb..cb9992775 100644 --- a/src/Logic/State/SearchState.ts +++ b/src/Logic/State/SearchState.ts @@ -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] ) diff --git a/src/UI/BigComponents/ThemesList.svelte b/src/UI/BigComponents/ThemesList.svelte index 7bd9d9f6f..c53da0ac1 100644 --- a/src/UI/BigComponents/ThemesList.svelte +++ b/src/UI/BigComponents/ThemesList.svelte @@ -14,6 +14,16 @@ export let state: { osmConnection: OsmConnection } export let onlyIcons: boolean = false export let hasSelection: boolean = true + let themesFiltered: MinimalThemeInformation[] = [] + for (const theme of themes) { + if (!theme) { + continue + } + if (themesFiltered.some(th => th.id === theme.id)) { + continue + } + themesFiltered.push(theme) + }
@@ -23,7 +33,7 @@ ? "flex flex-wrap items-center justify-center gap-x-2" : "theme-list my-2 gap-4 md:grid md:grid-flow-row md:grid-cols-2 lg:grid-cols-3"} > - {#each Utils.NoNull(themes) as theme (theme.id)} + {#each Utils.NoNull(themesFiltered) as theme (theme.id)} {#if $search && hasSelection && themes?.[0] === theme}