-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflict Handling? #149
Comments
Hi @ronag, pull requests #137 on the server and #105 for the JS client are currently under review, adding exactly the functionality that you describe. They will allow clients to specify a merge strategy that will be executed on conflict, both globally and on a per-record basis. You can find more details in this issue. Please let me know if this fulfills what you are looking for. |
@WolframHempel: Almost. I would like to have an API where the update can be easily retried against the server. As far as I can see the suggested changes are just to resolve conflicts on the client side not actually performing a server side transaction. |
if I'm not mistaken, that's very much what this will be: myRecord.setMergeStrategy(function( remoteValue, recordName, callback ) {
var localValue = ds.record.getRecord( recordName );
//do your merging, then retry
callback( error, mergedVersion );
}); |
That's correct, the merged version that is returned will be set onto the record as an update and sent to the server. If the merge conflict fails again the client will be notified, until it works. This is similar to how the transaction works. Only thing that's different is the api, which is:
This stops users from having to remember to discard the record, and also reduces what would have been a pretty long argument list. |
I've started looking into deep stream and the core issue I'm having is how to handle conflicts? e.g. I'm looking for something like https://www.firebase.com/docs/web/api/firebase/transaction.html or https://github.com/pouchdb/upsert.
The text was updated successfully, but these errors were encountered: