From 2e5e1166c8df47d878fc3a74da17d51dbcb4ee43 Mon Sep 17 00:00:00 2001 From: mike140 Date: Fri, 14 Feb 2025 22:18:47 +0000 Subject: [PATCH 1/5] Translated using Weblate (Ukrainian) Currently translated at 19.1% (801 of 4181 strings) Translation: MapComplete/layers Translate-URL: https://translate.mapcomplete.org/projects/mapcomplete/layers/uk/ --- langs/layers/uk.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/langs/layers/uk.json b/langs/layers/uk.json index 84dcb0231c..88246580e2 100644 --- a/langs/layers/uk.json +++ b/langs/layers/uk.json @@ -838,7 +838,8 @@ "question": "Як називається цей бізнес?", "render": "Цей бізнес називається {name}" } - } + }, + "name": "Кафе та паби" }, "caravansites": { "tagRenderings": { @@ -2999,4 +3000,4 @@ "render": "Утилізація відходів" } } -} \ No newline at end of file +} From 9de9f55327c2db3f18e0c11f66ba7a796080269e Mon Sep 17 00:00:00 2001 From: Weblate Date: Sat, 15 Feb 2025 21:03:10 +0100 Subject: [PATCH 2/5] Update translation files Updated by "Cleanup translation files" hook in Weblate. Translation: MapComplete/layers Translate-URL: https://translate.mapcomplete.org/projects/mapcomplete/layers/ --- langs/layers/nl.json | 42 ++---------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/langs/layers/nl.json b/langs/layers/nl.json index 8ccf620642..094f796b3a 100644 --- a/langs/layers/nl.json +++ b/langs/layers/nl.json @@ -2065,9 +2065,6 @@ }, "title": { "mappings": { - "0": { - "then": "{name}" - }, "1": { "then": "Vogelkijkhut {name}" }, @@ -6383,11 +6380,6 @@ } }, "title": { - "mappings": { - "0": { - "then": "{name}" - } - }, "render": "Natuurgebied" } }, @@ -6919,21 +6911,6 @@ "render": "Picknicktafel" } }, - "play_forest": { - "description": "Een speelbos is een vrij toegankelijke zone in een bos", - "name": "Speelbossen", - "title": { - "mappings": { - "0": { - "then": "{name}" - }, - "1": { - "then": "Speelbos {name}" - } - }, - "render": "Speelbos" - } - }, "playground": { "deletion": { "nonDeleteMappings": { @@ -8587,9 +8564,6 @@ }, "title": { "mappings": { - "0": { - "then": "{name}" - }, "1": { "then": "Voetpad" }, @@ -10755,25 +10729,13 @@ } }, "village_green": { - "description": "Een laag die dorpsgroen toont (gemeenschapsgroen, maar niet echt een park)", - "name": "Speelweide", - "title": { - "mappings": { - "0": { - "then": "{name}" - } - }, - "render": "Speelweide" - } + "description": "Een laag die dorpsgroen toont (gemeenschapsgroen, maar niet echt een park)" }, "visitor_information_centre": { "description": "Een bezoekerscentrum biedt informatie over een specifieke attractie of bezienswaardigheid waar het is gevestigd.", "name": "Bezoekerscentrum", "title": { "mappings": { - "0": { - "then": "{name:nl}" - }, "1": { "then": "{name}" } @@ -11003,4 +10965,4 @@ "render": "windturbine" } } -} \ No newline at end of file +} From 44b094e84ba9b3bd0375441ead54a6230de71b42 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sun, 16 Feb 2025 02:03:09 +0100 Subject: [PATCH 3/5] Fix: destroy the old core if needed --- src/Logic/FeatureSource/Sources/ThemeSource.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Logic/FeatureSource/Sources/ThemeSource.ts b/src/Logic/FeatureSource/Sources/ThemeSource.ts index e06b694c18..fc79e477a6 100644 --- a/src/Logic/FeatureSource/Sources/ThemeSource.ts +++ b/src/Logic/FeatureSource/Sources/ThemeSource.ts @@ -50,6 +50,7 @@ export default class ThemeSource implements IndexedFeatureSource { const features = (this.features = new UIEventSource([])) const featuresById = (this.featuresById = new UIEventSource(new Map())) this.core = mvtAvailableLayers.mapD((mvtAvailableLayers) => { + this.core?.data?.destruct() const core = new ThemeSourceCore( layers, featureSwitches, @@ -300,4 +301,9 @@ class ThemeSourceCore extends FeatureSourceMerger { // await Promise.all(this.supportsForceDownload.map((i) => i.updateAsync())) console.log("Done") } + + public destruct() { + this.features.destroy() + this.featuresById.destroy() + } } From d1328dadb3a0bf84cfe492d412856ed3a3261114 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sun, 16 Feb 2025 02:40:01 +0100 Subject: [PATCH 4/5] Refactoring: inline 'self' --- src/Logic/UIEventSource.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Logic/UIEventSource.ts b/src/Logic/UIEventSource.ts index 88b5dc953d..4b892bb714 100644 --- a/src/Logic/UIEventSource.ts +++ b/src/Logic/UIEventSource.ts @@ -626,11 +626,9 @@ class MappedStore extends Store { } private registerCallbacksToUpstream() { - const self = this - - this._unregisterFromUpstream = this._upstream.addCallback((_) => self.update()) + this._unregisterFromUpstream = this._upstream.addCallback((_) => this.update()) this._unregisterFromExtraStores = this._extraStores?.map((store) => - store?.addCallback((_) => self.update()) + store?.addCallback((_) => this.update()) ) this._callbacksAreRegistered = true } From 225b07970d7a335085fa28316863a63584be595b Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sun, 16 Feb 2025 02:40:26 +0100 Subject: [PATCH 5/5] Fix: attempt to fix #2312 --- src/UI/Map/ShowDataLayer.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/UI/Map/ShowDataLayer.ts b/src/UI/Map/ShowDataLayer.ts index 15aa40d70f..710891da7a 100644 --- a/src/UI/Map/ShowDataLayer.ts +++ b/src/UI/Map/ShowDataLayer.ts @@ -352,6 +352,11 @@ class LineRenderingLayer { // After waiting 'till the map has loaded, the data might have changed already // As such, we only now read the features from the featureSource and compare with the previously set data const features = featureSource.data + if (features.length === 0) { + // This is a very ugly workaround for https://source.mapcomplete.org/MapComplete/MapComplete/issues/2312, + // but I couldn't find the root cause + return + } const src = map.getSource(this._layername) { // Add source to the map or update the feature source