From 0393a330a6a6e7f52a18eabac339cf860b3c4aa7 Mon Sep 17 00:00:00 2001 From: vcoppe Date: Tue, 26 May 2026 06:18:00 +0200 Subject: [PATCH] fix loading initial style --- website/src/lib/components/map/style.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/website/src/lib/components/map/style.ts b/website/src/lib/components/map/style.ts index 7ff685666..d6cdac33e 100644 --- a/website/src/lib/components/map/style.ts +++ b/website/src/lib/components/map/style.ts @@ -66,10 +66,13 @@ export class StyleManager { updateBasemap() { const map_ = get(this._map); if (!map_) return; - this.buildStyle().then((style) => map_.setStyle(style)); + let basemap = get(currentBasemap); + this.buildStyle(basemap).then((style) => { + if (get(currentBasemap) === basemap) map_.setStyle(style); + }); } - async buildStyle(): Promise { + async buildStyle(basemap: string): Promise { const custom = get(customLayers); const style: maplibregl.StyleSpecification = { @@ -83,7 +86,6 @@ export class StyleManager { layers: [], }; - let basemap = get(currentBasemap); const basemapInfo = basemaps[basemap] ?? custom[basemap]?.value ?? basemaps[defaultBasemap]; let basemapStyle = basemaps.openStreetMap as maplibregl.StyleSpecification;