From 1aab83c7a177798e6a30eb7bd6173a74a90a9308 Mon Sep 17 00:00:00 2001 From: Robin Bourianes Date: Tue, 16 Jul 2024 09:38:02 +0200 Subject: [PATCH] fix: do not use mixin updateLayer() to restore geojson data for in memory layers --- map/client/mixins/map/mixin.geojson-layers.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/map/client/mixins/map/mixin.geojson-layers.js b/map/client/mixins/map/mixin.geojson-layers.js index 6e7c6b9ad..44fc2fa5a 100644 --- a/map/client/mixins/map/mixin.geojson-layers.js +++ b/map/client/mixins/map/mixin.geojson-layers.js @@ -599,7 +599,13 @@ export const geojsonLayers = { if (cachedGeojson) { if (isInMemoryLayer(layer)) { // Restore geojson data for in-memory layers that was hidden - this.updateLayer(layer.name, cachedGeojson) + // Directly deal with the leaflet layer instead of calling updateLayer, we are just restoring data + // Handle case where there's clustering on top (cf. updateLayer) + if (typeof engineLayer.getLayers === 'function') { + const container = engineLayer + engineLayer = container.getLayers().find(layer => layer._container === container) + } + engineLayer._onNewData(false, cachedGeojson) } else { // Clear cache since layer is not in memory anymore delete this.geojsonCache[layer.name]