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

@ -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)
}
</script>
<section class="w-full">
@ -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)}
<ThemeButton {theme} {state} iconOnly={onlyIcons}>
{#if $search && hasSelection && themes?.[0] === theme}
<span class="thanks hidden-on-mobile" aria-hidden="true">