fix: don't send anything if change is a noop

This commit is contained in:
əlemi 2024-08-14 23:53:51 +02:00
parent 783a51a831
commit 3e37d4ffe3
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -108,10 +108,12 @@ impl ControllerWorker<TextChange> for BufferWorker {
branch.insert(&mut oplog, agent_id, change.start as usize, &change.content);
}
if change.is_delete() || change.is_insert() {
tx.send(Operation { data: oplog.encode_from(Default::default(), &last_ver) }).await
.unwrap_or_warn("failed to send change!");
self.latest_version.send(oplog.local_version())
.unwrap_or_warn("failed to update latest version!");
}
ack.send(branch.local_version()).unwrap_or_warn("controller didn't wait for ack");
},
},