chore: remove _marked_for_deletion pattern

We think it's useless now that we use "editable:edited" event everywhere
(vs using the "editable:commit" which was triggered also after a delete,
when closing the edit panel)
This commit is contained in:
Yohan Boniface 2025-03-03 15:00:49 +01:00
parent 742a23b668
commit ea00d4fc32
2 changed files with 0 additions and 13 deletions

View file

@ -22,7 +22,6 @@ class Feature {
constructor(umap, datalayer, geojson = {}, id = null) { constructor(umap, datalayer, geojson = {}, id = null) {
this._umap = umap this._umap = umap
this.sync = umap.syncEngine.proxy(this) this.sync = umap.syncEngine.proxy(this)
this._marked_for_deletion = false
this._isDirty = false this._isDirty = false
this._ui = null this._ui = null
@ -147,17 +146,6 @@ class Feature {
// When the layer is a remote layer, we don't want to sync the creation of the // When the layer is a remote layer, we don't want to sync the creation of the
// points via the websocket, as the other peers will get them themselves. // points via the websocket, as the other peers will get them themselves.
if (this.datalayer?.isRemoteLayer()) return if (this.datalayer?.isRemoteLayer()) return
// The "endEdit" event is triggered at the end of an edition,
// and will trigger the sync.
// In the case of a deletion (or a change of layer), we don't want this
// event triggered to cause a sync event, as it would reintroduce
// deleted features.
// The `._marked_for_deletion` private property is here to track this status.
if (this._marked_for_deletion === true) {
this._marked_for_deletion = false
return
}
this.sync.upsert(this.toGeoJSON()) this.sync.upsert(this.toGeoJSON())
} }

View file

@ -30,7 +30,6 @@ const FeatureMixin = {
onRemove: function (map) { onRemove: function (map) {
this.parentClass.prototype.onRemove.call(this, map) this.parentClass.prototype.onRemove.call(this, map)
if (map.editedFeature === this.feature) { if (map.editedFeature === this.feature) {
this.feature._marked_for_deletion = true
this.feature.endEdit() this.feature.endEdit()
if (map.editedFeature === this.feature) { if (map.editedFeature === this.feature) {
map.editPanel.close() map.editPanel.close()