Bug Report
Before you file your issue
- Check the other issues before filing your own
Problematic behavior
It's possible for 2 clients working on the same document to overwrite each other's changes, causing data loss.
Expected behavior/code
I would expect some sort of coordination is required before allowing a save, so that changes are merged.
Steps to Reproduce
- Open an existing document on a mobile phone and make some changes.
- Put the phone to sleep (e.g., by clicking on the side button) or just switch to a different app.
- Wait a minute or so for the phone to drop its websocket connection.
- Open the same document from a different client (say, a desktop) and make some changes. (Note that the changes from the phone aren't visible.)
- On that client, navigate out of the document (triggering a save).
- Go back to the mobile phone version. Note that the changes from the desktop aren't visible.
- Navigate out of the document (triggering a save).
- The changes from the desktop are lost (unless one catches it in time and picks through the version history).
Environment
- Docs version: 4.5.0
- Instance url: (Tiny private instance; not accessible from the Internet)
Possible Solution
This feels like an architecture issue, and I'm not too familiar with the collaboration library, so I don't know if either of these solutions are practical:
- I read somewhere that the server stores a snapshot of the CRDT in object storage. Would it be possible for the server to merge changes coming from the client with the snapshot before saving, instead of just overwriting the snapshot? (edit: would need to be careful of race conditions when retrieving / merging / storing)
- Could the server run a client instance that automatically connects to every document's collaboration room? The issue does not happen if at least one client is connected to the collaboration room for the entire time: it's able to merge the changes. Under this solution, ideally only this always-connected client would be able to save changes -- clients wouldn't be able to directly send snapshots to the server.
Additional context/Screenshots
Thanks for making Docs! My family uses it for shared notes. Unfortunately, we often access it from a phone to make quick notes, and so even though we're careful to try saving the document every time we make an edit, it's very easy to forget on mobile especially -- so this issue bites us often.
Bug Report
Before you file your issue
Problematic behavior
It's possible for 2 clients working on the same document to overwrite each other's changes, causing data loss.
Expected behavior/code
I would expect some sort of coordination is required before allowing a save, so that changes are merged.
Steps to Reproduce
Environment
Possible Solution
This feels like an architecture issue, and I'm not too familiar with the collaboration library, so I don't know if either of these solutions are practical:
Additional context/Screenshots
Thanks for making Docs! My family uses it for shared notes. Unfortunately, we often access it from a phone to make quick notes, and so even though we're careful to try saving the document every time we make an edit, it's very easy to forget on mobile especially -- so this issue bites us often.