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.
This commit is contained in:
Alexis Métaireau 2024-05-16 18:37:47 +02:00
parent 516c3d9a0d
commit 50b7188647

View file

@ -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()