From 0b84084c6b91ae3c05e33bcb9aa1c819913dbe3f Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 20 Mar 2025 17:09:44 +0100 Subject: [PATCH] fixup: make sure to toggle remote client state at save too Co-authored-by: David Larlet --- umap/static/umap/js/modules/sync/engine.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/umap/static/umap/js/modules/sync/engine.js b/umap/static/umap/js/modules/sync/engine.js index 7676f2de..90da9258 100644 --- a/umap/static/umap/js/modules/sync/engine.js +++ b/umap/static/umap/js/modules/sync/engine.js @@ -399,6 +399,7 @@ export class SyncEngine { onSavedMessage({ sender, lastKnownHLC }) { debug(`received saved message from peer ${sender}`, lastKnownHLC) this._operations.saved(lastKnownHLC) + this._undoManager.toggleState() } /** @@ -471,7 +472,7 @@ export class Operations { } saved(hlc) { - for (const operation of this.getOperationsSince(hlc)) { + for (const operation of this.getOperationsBefore(hlc)) { operation.dirty = false } } @@ -543,6 +544,11 @@ export class Operations { return this._operations.filter((op) => op.hlc > hlc) } + getOperationsBefore(hlc) { + if (!hlc) return this._operations + return this._operations.filter((op) => op.hlc <= hlc) + } + /** * Returns the last known HLC value. */