Repository navigation
fix(notes): stop autosave from raising revision conflicts while typing - #313
Merged
Merged
Conversation
The note editor built each save from the cached note's revision, but the post-save reload is skipped while a field has focus, so the second debounced save sent a stale revision and failed with NoteRevisionConflictException. Track the latest revision from save responses and serialize saves so each uses the previous result.
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.
Problem
A user report (v0.24.0, Android) shows
NoteRevisionConflictException: The note was changed by another operation.while editing a note. Since v0.24.0 (0f46c172), the note editor sends anUpdateNoteCommandwith an expected revision. The revision comes from the cached note, and the reload after a save is skipped while the title or content field has focus. So the second debounced save while typing sends a stale revision, and the conditional update rejects it.Fix
NoteDetailsContentnow tracks the latest revision itself, taking it from each save response and from reloads. Saves also run one after another, so each save uses the revision produced by the previous one.Tests
note_details_content_test.dartsends two consecutive autosaves with the field focused, against a mediator that enforces the revision check. It fails before the fix (1 conflict) and passes after it.dart analyzeand format are clean on the changed files.flutter test: the only failures are pre-existing ones that also fail onmain(desktop_server_sync_service_test.dart,desktop_sync_service_test.dart,integration/mcp_user_actions_test.dart).