Fix: Sort revisions by note version #1605
Merged
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.
See #394 where the sorting was introduced
When we make changes to a note we append a
modificationDate
valuewhich serves as a timestamp of the change on the client device making
the change. That is, the timestamp is meant to provide an indicator of
when in real time the change happened, but since it's based on a
device's clock we cannot rely on it or use it for proper sequencing.
It happens from time to time (especially when one device is offline)
that a revision which occurs after another remote change gets a
timestamp showing that it happened before because the local device
recorded the timestamp before the change made it to the Simperium
server.
When this happens the application will show those revisions out of the
actual order they took place and this can lead to confusing note
history. In this patch we're sorting the revisions based on the version
of the note and not the timestamp. This produces the proper sequencing
of changes in the note's history.
This change will present certain scenarios where it appears as though
the revisions are out-of-order because they are showing their
modification times even when those conflict with the version-ordering.
We should consider a way to communicate this, possibly with a tooltip
or a contextual notice when we detect these conflicts.
Testing
Local
andRemote
.A
Local
's network access.Local
addC
to make the noteAC
Remote
connected, addB
to make the note readAB
after changing the note onLocal
.Local
and let the changes synchronize.In develop you should find that the revision slider shows that the
change from
Local
happened first. In this branch you should see the remotechange happening first. The timestamps in this branch will appear out of order
but the actual note changes will be in order.
A
A
ABC
AB
AB
ABC
This bug appears like a synchronization bug but is actually a display bug.