fixup: make sure to toggle remote client state at save too

Co-authored-by: David Larlet <david@larlet.fr>
This commit is contained in:
Yohan Boniface 2025-03-20 17:09:44 +01:00
parent dfdfae0080
commit 5cb7cb2738

View file

@ -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.
*/