From d5c1e361c396dbbebf34e86300d864abdf3cd2fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9taireau?= Date: Thu, 16 May 2024 18:37:47 +0200 Subject: [PATCH] fix(sync): sync the `reference-version` across peers This allows the merge algorithm to not be lost when receiving changes. Without this change, the optimistic merge algorithm isn't able to make the distinction between peers, and features end up duplicated. --- umap/static/umap/js/umap.layer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/umap/static/umap/js/umap.layer.js b/umap/static/umap/js/umap.layer.js index a7ece857..f9c688e3 100644 --- a/umap/static/umap/js/umap.layer.js +++ b/umap/static/umap/js/umap.layer.js @@ -1740,6 +1740,10 @@ U.DataLayer = L.Evented.extend({ delete data.geojson } this._reference_version = response.headers.get('X-Datalayer-Version') + + const { engine, subject, metadata } = this.getSyncMetadata() + engine.update(subject, metadata, '_reference_version', this._reference_version) + this.setUmapId(data.id) this.updateOptions(data) this.backupOptions()