From 053bfc525ca69f595100dd363abde8e518a3bb4b Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Sat, 15 Feb 2025 18:32:44 +0100 Subject: [PATCH] Fix point deletion --- CHANGELOG.md | 1 + app/javascript/controllers/maps_controller.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 398c57b3..ecfa1c72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## Fixed - Fixed a bug where background jobs to import Immich and Photoprism geolocation data data could not be created by non-admin users. +- Fixed a bug where upon point deletion there was an error it was not being removed from the map, while it was actually deleted from the database. #883 ### Changed diff --git a/app/javascript/controllers/maps_controller.js b/app/javascript/controllers/maps_controller.js index 2986b5e3..9868368a 100644 --- a/app/javascript/controllers/maps_controller.js +++ b/app/javascript/controllers/maps_controller.js @@ -393,7 +393,7 @@ export default class extends BaseController { baseMaps() { let selectedLayerName = this.userSettings.preferred_map_layer || "OpenStreetMap"; - let maps; createAllMapLayers(this.map, selectedLayerName); + let maps = createAllMapLayers(this.map, selectedLayerName); // Add custom map if it exists in settings if (this.userSettings.maps && this.userSettings.maps.url) { @@ -517,13 +517,13 @@ export default class extends BaseController { if (this.layerControl) { this.map.removeControl(this.layerControl); const controlsLayer = { - Points: this.markersLayer, - Routes: this.polylinesLayer, - Heatmap: this.heatmapLayer, - "Fog of War": this.fogOverlay, - "Scratch map": this.scratchLayer, - Areas: this.areasLayer, - Photos: this.photoMarkers + Points: this.markersLayer || L.layerGroup(), + Routes: this.polylinesLayer || L.layerGroup(), + Heatmap: this.heatmapLayer || L.layerGroup(), + "Fog of War": new this.fogOverlay(), + "Scratch map": this.scratchLayer || L.layerGroup(), + Areas: this.areasLayer || L.layerGroup(), + Photos: this.photoMarkers || L.layerGroup() }; this.layerControl = L.control.layers(this.baseMaps(), controlsLayer).addTo(this.map); }