Fix: fix crash in GRB theme when replacing geometry

This commit is contained in:
Pieter Vander Vennet 2025-08-20 01:09:11 +02:00
parent 046e7d801f
commit 3c5a528307

View file

@ -1,7 +1,6 @@
<script lang="ts"> <script lang="ts">
import Loading from "../Base/Loading.svelte" import Loading from "../Base/Loading.svelte"
import MaplibreMap from "../Map/MaplibreMap.svelte" import MaplibreMap from "../Map/MaplibreMap.svelte"
import { Utils } from "../../Utils"
import { Store, UIEventSource } from "../../Logic/UIEventSource" import { Store, UIEventSource } from "../../Logic/UIEventSource"
import FilteredLayer from "../../Models/FilteredLayer" import FilteredLayer from "../../Models/FilteredLayer"
import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig" import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig"
@ -13,6 +12,8 @@
import type { AutoAction } from "./AutoApplyButtonVis" import type { AutoAction } from "./AutoApplyButtonVis"
import Tr from "../Base/Tr.svelte" import Tr from "../Base/Tr.svelte"
import Translations from "../i18n/Translations" import Translations from "../i18n/Translations"
import { Lists } from "../../Utils/Lists"
import type { OsmFeature } from "../../Models/OsmFeature"
/** /**
* The ids to handle. Might be data from an external dataset, we cannot assume an OSM-id * The ids to handle. Might be data from an external dataset, we cannot assume an OSM-id
@ -42,12 +43,12 @@
mla.allowZooming.setData(false) mla.allowZooming.setData(false)
mla.allowMoving.setData(false) mla.allowMoving.setData(false)
const features = ids.mapD((ids) => const features: Store<OsmFeature[]> = ids.mapD((ids) =>
ids.map((id) => state.indexedFeatures.featuresById.data.get(id)) ids.map<OsmFeature>((id) => state.indexedFeatures.featuresById.data.get(id))
) )
new ShowDataLayer(mlmap, { new ShowDataLayer(mlmap, {
features: StaticFeatureSource.fromGeojson(features), features: new StaticFeatureSource(features),
zoomToFeatures: true, zoomToFeatures: true,
layer: layer.layerDef, layer: layer.layerDef,
}) })
@ -121,10 +122,10 @@
<div class="alert">Target tagrendering {options.targetTagRendering} not found"</div> <div class="alert">Target tagrendering {options.targetTagRendering} not found"</div>
{:else if $ids.length === 0} {:else if $ids.length === 0}
<div>No elements found to perform action</div> <div>No elements found to perform action</div>
{:else if $buttonState.error !== undefined} {:else if $buttonState["error"] !== undefined}
<div class="flex flex-col"> <div class="flex flex-col">
<div class="alert">Something went wrong</div> <div class="alert">Something went wrong</div>
<div>{$buttonState.error}</div> <div>{$buttonState["error"]}</div>
</div> </div>
{:else if $buttonState === "done"} {:else if $buttonState === "done"}
<div class="thanks">All done!</div> <div class="thanks">All done!</div>