All: Fixes #13531: When creating a conflict, ensure the latest note contents are used to create the conflict#13552
Merged
laurent22 merged 6 commits intolaurent22:devfrom Nov 3, 2025
Conversation
… create the conflict
laurent22
reviewed
Oct 29, 2025
| } | ||
| } else if (action === SyncAction.NoteConflict) { | ||
| // Reload the note, to ensure the latest version is used to create the conflict | ||
| local = await Note.load(local.id); |
Owner
There was a problem hiding this comment.
I guess it would be difficult to add a test for this?
Owner
|
That's great, thanks for adding the test @mrjo118! |
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.
The conflict resolution process handles conflicts for notes by creating a conflict using the local note contents and then replaces the local note with the remote note. Currently, the process will select the local note contents during the upload step of the Synchroniser code. This means that if there are many uploads queued, it is possible that if a conflict is created for a note which is currently being edited by a user, an outdated version of the note will be used to create the conflicting note, and some text which the user has just typed may be lost.
Reproduction steps (this is easier to reproduce on desktop, due to the 15 second delay for sync as you type):
In order to remedy this, this PR re-selects the local note immediately before creating the note conflict, so that the latest contents will be used.
This fixes #13531
Limitations
Note that if the user is typing continuously and they type faster than the debounce interval for the note editor (100ms desktop and 500ms on mobile), some changes may still be lost because they are not currently saved when the note is reloaded. Also, if the user happens to be typing just at the point when the conflict is created, the replacement of the local note contents with the remote contents may not have time to re-render, and therefore they are lost to the local version, due to a local save overwriting the change made by the conflict resolution. I'm not sure how this can be prevented to be honest, but it should be a rarer occurrence than the bug which this PR does address.
Testing
See videos following the reproduction steps.
Before:
issue.1.mp4
After:
issue.1.fix.mp4