Fix: small fixes and crashes

This commit is contained in:
Pieter Vander Vennet 2025-02-16 01:34:54 +01:00
parent 33ec30339b
commit d17d07ec52
4 changed files with 8 additions and 6 deletions

View file

@ -16,7 +16,7 @@ export class ThemeSearchIndex {
private readonly layerIndex: Fuse<{ id: string, description }> private readonly layerIndex: Fuse<{ id: string, description }>
constructor(language: string, themesToSearch?: MinimalThemeInformation[], layersToIgnore: string[] = []) { constructor(language: string, themesToSearch?: MinimalThemeInformation[], layersToIgnore: string[] = []) {
const themes = themesToSearch ?? ThemeSearch.officialThemes?.themes const themes = Utils.NoNull(themesToSearch ?? ThemeSearch.officialThemes?.themes)
if (!themes) { if (!themes) {
throw "No themes loaded. Did generate:layeroverview fail?" throw "No themes loaded. Did generate:layeroverview fail?"
} }
@ -31,7 +31,7 @@ export class ThemeSearchIndex {
] ]
} }
this.themeIndex = new Fuse(themes.filter(th => th.id !== "personal"), fuseOptions) this.themeIndex = new Fuse(themes.filter(th => th?.id !== "personal"), fuseOptions)
const toIgnore = new Set(layersToIgnore) const toIgnore = new Set(layersToIgnore)
const layersAsList: { id: string, description: Record<string, string[]> }[] = [] const layersAsList: { id: string, description: Record<string, string[]> }[] = []

View file

@ -8,7 +8,6 @@ import Translations from "../../UI/i18n/Translations"
import { RegexTag } from "../Tags/RegexTag" import { RegexTag } from "../Tags/RegexTag"
import { Or } from "../Tags/Or" import { Or } from "../Tags/Or"
import FilterConfig from "../../Models/ThemeConfig/FilterConfig" import FilterConfig from "../../Models/ThemeConfig/FilterConfig"
import Constants from "../../Models/Constants"
export type ActiveFilter = { export type ActiveFilter = {
layer: LayerConfig layer: LayerConfig

View file

@ -45,7 +45,7 @@ export class WithSelectedElementState extends UserMapFeatureswitchState {
selected?.properties?.name, selected?.properties?.name,
selected?.properties?.alt_name, selected?.properties?.alt_name,
selected?.properties?.local_name, selected?.properties?.local_name,
layer?.title.GetRenderValue(selected?.properties ?? {}).txt, layer?.title?.GetRenderValue(selected?.properties ?? {})?.txt,
selected.properties.display_name, selected.properties.display_name,
selected.properties.id, selected.properties.id,
] ]

View file

@ -29,7 +29,7 @@ class QuestionViz implements SpecialVisualizationSvelte {
}, },
{ {
name: "blacklisted-labels", name: "blacklisted-labels",
doc: "One or more ';'-separated labels of questions which should _not_ be included", doc: "One or more ';'-separated labels of questions which should _not_ be included. Default: 'hidden'"
}, },
] ]
svelteBased = true svelteBased = true
@ -46,10 +46,13 @@ class QuestionViz implements SpecialVisualizationSvelte {
?.split(";") ?.split(";")
?.map((s) => s.trim()) ?.map((s) => s.trim())
?.filter((s) => s !== "") ?.filter((s) => s !== "")
const blacklist = args[1] const blacklist = (args[1])
?.split(";") ?.split(";")
?.map((s) => s.trim()) ?.map((s) => s.trim())
?.filter((s) => s !== "") ?.filter((s) => s !== "")
if (blacklist.length === 0) {
blacklist.push("hidden")
}
return new SvelteUIElement(Questionbox, { return new SvelteUIElement(Questionbox, {
layer, layer,
tags, tags,