Forget buffered operations when resyncing with the host

Antonio Scandurra created

Previously, we could end up with a situation where the host did not
see an operation but a guest that didn't have that buffer open would. When
such guest would finally open the buffer, they would apply the operation
without however sending it to the host. The guest wouldn't bother resyncing
it because it wasn't part of its open buffers.

Change summary

crates/project/src/project.rs | 2 ++
1 file changed, 2 insertions(+)

Detailed changes

crates/project/src/project.rs 🔗

@@ -4725,6 +4725,8 @@ impl Project {
             }
 
             if is_host {
+                this.opened_buffers
+                    .retain(|_, buffer| !matches!(buffer, OpenBuffer::Operations(_)));
                 this.buffer_changes_tx
                     .unbounded_send(BufferMessage::Resync)
                     .unwrap();