You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix: Stop rebasing sent changes when receiving remote updates (#78)
See prior version in #75 - this is a more formal change
When we have sent changes for an entity and are waiting for server's
response we might first receive updates from the server that represent
changes which another client made to the same entity.
In those cases we have been forgetting about the changes we sent and
then transforming our local changes to the new updates. To our client it
appears like we have made changes locally on top of the remote changes
when in reality we only made changes to the previous base version of the
entity.
The result of this forgetfulness is that we replay changes that should
only happen once. This might appear in the form of duplicated content
but could expose itself in other forms.
In this patch we're guarding the transformation based on the presence of
those waiting changes. If we get updates while waiting, simply apply
those updates to our internal ghost and let the client handle our
original submission once it comes back. If it comes back confirmed by
the server we'll be able to apply the updated patch which the server
created. If it gets rejected we will end up sending the full copy of our
changes and mess up the note but the original data should remian in
the history.
This patch includes a test which demonstrates the sequence that produces
the issue and verifies that it doesn't return.
Props to @beaucollins for his work figuring this stuff out.
- Fixed data corruption when remote updates arrive while waiting on confirmation of local changes [#78](https://github.com/Simperium/node-simperium/pull/78)
0 commit comments