wip: allow to sync version restore

Co-authored-by: David Larlet <david@larlet.fr>
This commit is contained in:
Yohan Boniface 2025-03-26 18:46:59 +01:00
parent c933df585c
commit e41ad4e069
2 changed files with 8 additions and 2 deletions

View file

@ -918,7 +918,11 @@ export class DataLayer {
)
if (!error) {
if (geojson._storage) geojson._umap_options = geojson._storage // Retrocompat.
if (geojson._umap_options) this.setOptions(geojson._umap_options)
if (geojson._umap_options) {
const oldOptions = Utils.CopyJSON(this.options)
this.setOptions(geojson._umap_options)
this.sync.update('options', this.options, oldOptions)
}
this.empty()
if (this.isRemoteLayer()) this.fetchRemoteData()
else this.addData(geojson)

View file

@ -52,7 +52,9 @@ export class DataLayerUpdater extends BaseUpdater {
update({ key, metadata, value }) {
const datalayer = this.getDataLayerFromID(metadata.id)
if (Utils.fieldInSchema(key)) {
if (key === 'options') {
datalayer.setOptions(value)
} else if (Utils.fieldInSchema(key)) {
Utils.setObjectValue(datalayer, key, value)
} else {
console.debug(