Refactor: Use direct comparison of note id when receiving remote upates #1838
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.
In
onNoteBeforeRemoteUpdate
we give ourselves a chance to rebase local editson a note before remote changes are applied. Although we haven't identified any
problem related to this refactor, we have been using indirect measures to check
if the note we are working with is the note we think it is. That is, we were
checking against
selectedNoteId
as a proxy fornote.id
when relying onnote.id
works and eliminates the possibility thatselectedNoteId
doesn'tmatch
note.id
In this patch we're simplifying to rely solely on that direct measure and
eliminting one possible bug.
Testing
Since I'm not sure that this has been causing any issues I don't know how to test it.
Please smoke-test the app.
Verify that remote updates correctly "rebase" local changes when they come in.
You'll need to sequence a change on another device to occur before local changes
flush and send their updates to the server.