From 50b71886473a391899ba72f00e6b794a85d05b13 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()