From 18f0b6e2a7656cb3f8bd9b60f99af40fbb9a119c Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 9 Apr 2025 11:27:04 +0200 Subject: [PATCH] chore: rename variable to make it more explicit --- umap/static/umap/js/modules/data/features.js | 7 +++---- umap/static/umap/js/umap.controls.js | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/umap/static/umap/js/modules/data/features.js b/umap/static/umap/js/modules/data/features.js index 513ac0b3..be5de91b 100644 --- a/umap/static/umap/js/modules/data/features.js +++ b/umap/static/umap/js/modules/data/features.js @@ -146,14 +146,13 @@ class Feature { } onCommit() { + this.pullGeometry(false) // 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. - const oldGeoJSON = this._just_married ? null : Utils.CopyJSON(this.toGeoJSON()) - this.pullGeometry(false) if (this.datalayer?.isRemoteLayer()) return - if (this._just_married) { + if (this._needs_upsert) { this.sync.upsert(this.toGeoJSON(), null) - this._just_married = false + this._needs_upsert = false } else { this.sync.update('geometry', this.geometry, this._geometry_bk) } diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 9dbddbac..8c302a5a 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -629,7 +629,7 @@ U.Editable = L.Editable.extend({ const line = new U.LineString(this._umap, datalayer, { geometry: { type: 'LineString', coordinates: [] }, }) - line._just_married = true + line._needs_upsert = true return line.ui }, @@ -638,7 +638,7 @@ U.Editable = L.Editable.extend({ const poly = new U.Polygon(this._umap, datalayer, { geometry: { type: 'Polygon', coordinates: [] }, }) - poly._just_married = true + poly._needs_upsert = true return poly.ui }, @@ -647,7 +647,7 @@ U.Editable = L.Editable.extend({ const point = new U.Point(this._umap, datalayer, { geometry: { type: 'Point', coordinates: [latlng.lng, latlng.lat] }, }) - point._just_married = true + point._needs_upsert = true return point.ui },