From 330a7a5a0a162844079dd3aa29a74fef769c0978 Mon Sep 17 00:00:00 2001 From: Johannes Baumeister Date: Thu, 25 Jun 2026 09:58:56 +0200 Subject: [PATCH] fix: prevent ReferenceError and avoid loading local config layers for non-default projects to avoid wrong project startup zoom --- app.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 14a2dca..dbf94c4 100644 --- a/app.js +++ b/app.js @@ -1208,6 +1208,8 @@ document.addEventListener('DOMContentLoaded', async () => { }; try { + const projId = getProjektId(); + // Priority 1: Use globalThis.BAKED_DATA if available (Standalone Mode) if (globalThis.BAKED_DATA) { // Support both old format (direct layers) and new format (with mapping/statuses) @@ -1222,14 +1224,16 @@ document.addEventListener('DOMContentLoaded', async () => { } // Priority 2: Use globalThis.LAYER_CONFIG (Script-based config) or remote config - const layers = await resolveLayerConfig(isLocalFile, statusEl); - if (layers) { - await loadConfigLayers(layers); + // Only load local config layers if the project is the default (bwsamern-ohne) + if (projId.toLowerCase() === 'bwsamern-ohne') { + const layers = await resolveLayerConfig(isLocalFile, statusEl); + if (layers) { + await loadConfigLayers(layers); + } } // ALKIS aus Datenbank IMMER laden console.log("Lade ALKIS-Layer aus Datenbank..."); - const projId = getProjektId(); const alkisResp = await fetch(`/api/layers/alkis?project=${encodeURIComponent(projId)}`).catch(err => { console.error("Netzwerkfehler beim Laden des ALKIS-Layers:", err); return null;