remotestorage / remotestorage.js

⬡ JavaScript client library for integrating remoteStorage in apps
https://remotestoragejs.readthedocs.io
MIT License
2.32k stars 141 forks source link

Conflict handling not explained in docs #826

Closed raucao closed 1 month ago

raucao commented 9 years ago

The docs explain what a conflict event will look like:

http://remotestorage.io/doc/code/files/baseclient-js.html#RemoteStorage.BaseClient.change

But they don't have an example of how to actually handle a conflict. Apparently in the olden days of the conflict object, there was a resolve method on that:

https://github.com/nilclass/remotestorage-browser-example/blob/7085df59f2601d72a415c2bc9872134955857200/src/tree.js#L20-L24

So it's also not clear how to update that code.

rosano commented 4 years ago

Is there any documentation on how to manually resolve conflicts? I have found the following links that describe some things but I'm still not sure what to do practically speaking:

I am trying to respond to a conflict event by comparing sub-properties of oldValue and newValue (for example a date in the object) and then calling storeObject on the winner, but I seem to be receiving repeated conflict events after saving. Not sure if this is a bug or if I haven't followed the docs. Here's a video: https://www.dropbox.com/s/7cr91y4hkpljap7/2020.07.01%20conflict.mp4?dl=0

rosano commented 4 years ago

I just found the following in #684:

But instead of this now firing a conflict event, the request is repeated indefinitely.

I wonder if it has anything to do with my issue.

@skddc Do you have any guidance on this?

raucao commented 4 years ago

That bug seems to have been fixed a very long time ago:

This bug is fixed in #697 which has already passed first review

If anyone has guidance, it would be @michielbdejong who both opened and fixed that bug...

rosano commented 4 years ago

I was able to stop the conflict event from firing repeatedly by updating the object inside setTimeout. I'm guessing there's an issue when 'conflict handling' happens synchronously.