fix: allow to save a remote data with unloaded data (#2657)

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.
This commit is contained in:
Yohan Boniface 2025-04-23 17:49:12 +02:00 committed by GitHub
commit 92ca581fb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -656,7 +656,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')
@ -1116,7 +1116,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)