fix: prevent ReferenceError and avoid loading local config layers for non-default projects to avoid wrong project startup zoom
This commit is contained in:
parent
a92b054645
commit
330a7a5a0a
12
app.js
12
app.js
|
|
@ -1208,6 +1208,8 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const projId = getProjektId();
|
||||||
|
|
||||||
// Priority 1: Use globalThis.BAKED_DATA if available (Standalone Mode)
|
// Priority 1: Use globalThis.BAKED_DATA if available (Standalone Mode)
|
||||||
if (globalThis.BAKED_DATA) {
|
if (globalThis.BAKED_DATA) {
|
||||||
// Support both old format (direct layers) and new format (with mapping/statuses)
|
// 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
|
// Priority 2: Use globalThis.LAYER_CONFIG (Script-based config) or remote config
|
||||||
const layers = await resolveLayerConfig(isLocalFile, statusEl);
|
// Only load local config layers if the project is the default (bwsamern-ohne)
|
||||||
if (layers) {
|
if (projId.toLowerCase() === 'bwsamern-ohne') {
|
||||||
await loadConfigLayers(layers);
|
const layers = await resolveLayerConfig(isLocalFile, statusEl);
|
||||||
|
if (layers) {
|
||||||
|
await loadConfigLayers(layers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ALKIS aus Datenbank IMMER laden
|
// ALKIS aus Datenbank IMMER laden
|
||||||
console.log("Lade ALKIS-Layer aus Datenbank...");
|
console.log("Lade ALKIS-Layer aus Datenbank...");
|
||||||
const projId = getProjektId();
|
|
||||||
const alkisResp = await fetch(`/api/layers/alkis?project=${encodeURIComponent(projId)}`).catch(err => {
|
const alkisResp = await fetch(`/api/layers/alkis?project=${encodeURIComponent(projId)}`).catch(err => {
|
||||||
console.error("Netzwerkfehler beim Laden des ALKIS-Layers:", err);
|
console.error("Netzwerkfehler beim Laden des ALKIS-Layers:", err);
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue