Desktop: Prevent the remote version of a note being overwritten if typing while the sync changes the open note - #16206
Open
mrjo118 wants to merge 8 commits into
Open
Conversation
…secondary windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes equivalent issues to PR #16193 which are present in the desktop app.
Changing the note contents within about 0.5 seconds before the note is reloaded via an update by the sync, can cause the remote version to be overwritten with the local contents in the current editor. This can be a serious data integrity issue, particularly with the upcoming introduction of automatically resolved conflicts, where the resolved version could also get lost as a result of multiple possible race conditions.
This PR addresses the issue by implementing the following for the mobile note editor:
Note that when typing really fast, it is possible to lose some of the text typed in the last second or so, but this is much better than losing the entire changes from remote versions or auto merged conflicts.
Testing
Manual testing covered the following scenarios:
Original behaviour:
Ojd2LZCHZj.single.change.mp4
New behaviour, demonstrating no content overwritten for the title, MDE, RTE and plain text editor without encryption enabled (note I accidentally used the legacy markdown editor for most of the MDE tests, but I did a thorough test with CM6 too):
5fsWmgfdWt.fix.all.no.e2e.mp4
New behaviour showing a few tests with E2EE enabled:
xLaqbzP8UN.new.md.e2ee.mp4