diff --git a/src/Logic/MetaTagging.ts b/src/Logic/MetaTagging.ts index da5ac32fa..6062d2356 100644 --- a/src/Logic/MetaTagging.ts +++ b/src/Logic/MetaTagging.ts @@ -228,6 +228,10 @@ export default class MetaTagging { }) return feats } + if(!state.perLayer.get(layerId)){ + // This layer is not loaded + return [] + } return [state.perLayer.get(layerId).GetFeaturesWithin(bbox)] }, } diff --git a/src/Models/ThemeConfig/Conversion/PrepareTheme.ts b/src/Models/ThemeConfig/Conversion/PrepareTheme.ts index 815860321..656e33479 100644 --- a/src/Models/ThemeConfig/Conversion/PrepareTheme.ts +++ b/src/Models/ThemeConfig/Conversion/PrepareTheme.ts @@ -475,7 +475,13 @@ class AddDependencyLayersToTheme extends DesugaringStep { ) } } - layers.unshift(...dependencies.map((l) => l.config)) + /** + * Must be added to the _end_ of the layer list: + * - Imagine that 'walls_and_buildings' is added... + * - but there is a layer about a specific type of building already + * Adding it up front would cause 'walls_and_buildings' to be triggered + */ + layers.push(...dependencies.map((l) => l.config)) return { ...theme, diff --git a/src/Utils.ts b/src/Utils.ts index bbddfc418..189251f5c 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -331,11 +331,16 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be configurable: true, get: () => { delete object[name] - object[name] = init() - if (whenDone) { - whenDone() + try{ + object[name] = init() + if (whenDone) { + whenDone() + } + return object[name] + }catch (e) { + console.error("Error while calculating a lazy property", e) + return undefined } - return object[name] }, }) }