diff --git a/umap/static/umap/js/modules/data/layer.js b/umap/static/umap/js/modules/data/layer.js index 5d97da58..3210cfde 100644 --- a/umap/static/umap/js/modules/data/layer.js +++ b/umap/static/umap/js/modules/data/layer.js @@ -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) diff --git a/umap/static/umap/js/modules/sync/updaters.js b/umap/static/umap/js/modules/sync/updaters.js index e83ef2a7..07d96660 100644 --- a/umap/static/umap/js/modules/sync/updaters.js +++ b/umap/static/umap/js/modules/sync/updaters.js @@ -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(