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 8e1cf7b6da
commit d5c1e361c3
No known key found for this signature in database
GPG key ID: 1C21B876828E5FF2

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