From 169be734889bfe6a7e44ed2bd6d57ceba102ec82 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 16 Apr 2025 16:00:26 +0200 Subject: [PATCH] fix: allow to save a remote data with unloaded data When loading remote data fails, the layer is in state "unloaded", and thus it was not possible to save it. This "isLoaded" check is made for non remote layer so that we don't save it by mistake with no data. Also, let's allow to edit non loaded layers, this check was there when settings was not on db, so not all loaded at map init, again not to override with incomplete metadata. --- umap/static/umap/js/modules/data/layer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/modules/data/layer.js b/umap/static/umap/js/modules/data/layer.js index 617fea1a..d473031f 100644 --- a/umap/static/umap/js/modules/data/layer.js +++ b/umap/static/umap/js/modules/data/layer.js @@ -645,7 +645,7 @@ export class DataLayer { } edit() { - if (!this._umap.editEnabled || !this.isLoaded()) { + if (!this._umap.editEnabled) { return } const container = DomUtil.create('div', 'umap-layer-properties-container') @@ -1105,7 +1105,7 @@ export class DataLayer { async save() { if (this.isDeleted) return await this.saveDelete() - if (!this.isLoaded()) return + if (!this.isRemoteLayer() && !this.isLoaded()) return const geojson = this.umapGeoJSON() const formData = new FormData() formData.append('name', this.options.name)