From 82ede035d6e8ff8522f249f06ab2893da0ae1942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Wed, 15 May 2024 18:54:56 +0200 Subject: [PATCH] chore(sync): use `sync=false` everywhere to stop propagation In some cases, you want to stop the propagation of events. The previous code was using `fromSync=true` and `sync=false` interchangeably. This makes it use `sync=false` everywhere. --- umap/static/umap/js/modules/sync/updaters.js | 2 +- umap/static/umap/js/umap.features.js | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/umap/static/umap/js/modules/sync/updaters.js b/umap/static/umap/js/modules/sync/updaters.js index d7a45492..29c1c995 100644 --- a/umap/static/umap/js/modules/sync/updaters.js +++ b/umap/static/umap/js/modules/sync/updaters.js @@ -122,6 +122,6 @@ export class FeatureUpdater extends BaseUpdater { // XXX Distinguish between properties getting deleted // and the wole feature getting deleted let feature = this.getFeatureFromMetadata(metadata) - if (feature) feature.del() + if (feature) feature.del(false) } } diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index e171daf8..fbe0af5c 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -286,16 +286,14 @@ U.FeatureMixin = { } return false }, - - del: function (fromSync) { + del: function (sync) { this.isDirty = true this.map.closePopup() if (this.datalayer) { this.datalayer.removeLayer(this) this.disconnectFromDataLayer(this.datalayer) - // Do not relay the event if we received it. - if (!fromSync) this.syncDelete() + if (sync !== false) this.syncDelete() } },