Git Product home page Git Product logo

Comments (5)

tannercollin avatar tannercollin commented on May 31, 2024

I don't think I added any logic for handling sync conflicts. I almost never have them with the official clients because they save and sync so frequently.

@mobitar, any tips on detecting sync conflicts?

from standardnotes-fs.

moughxyz avatar moughxyz commented on May 31, 2024

Conflicts are returned by the server in an array called unsaved_items. This is the server letting the client know that the items the client sent to be saved were rejected, because saving them would have resulted in overwriting data. So if the client doesn't handle these unsaved_items, then you'd perpetually have unsycned changes.

from standardnotes-fs.

tannercollin avatar tannercollin commented on May 31, 2024

I don't see an unsaved_items array, but rather a conflicts array:

    "conflicts": [
        {
            "server_item": {
                "uuid": "4c0bcd94-8c27-11eb-8699-854761ae33c6",
                "duplicate_of": null,
                "items_key_id": "417b0d02-c431-4f65-ac6f-5927d77e69cf",
                "content": "003:06870....5Aw==",
                "content_type": "Note",
                "enc_item_key": "003:d4260....+Fc9L",
                "auth_hash": null,
                "created_at": "2021-03-23T22:29:57.238Z",
                "updated_at": "2021-03-23T22:32:34.871Z",
                "deleted": false
            },
            "type": "sync_conflict"
        }
    ],

The server seems to keep sending it over and over. What's the correct way to handle a conflict and mark it resolved? Is this documented anywhere? Thanks!

from standardnotes-fs.

moughxyz avatar moughxyz commented on May 31, 2024

conflicts is part of an older API version. You should be passing 20200115 as the version param to sync requests.

To handle conflicts you'd need to take the items in the unsaved_items array and create new items out of them (with new UUIDs). That would resolve the conflict essentially.

In SN clients it's a little more intricate since we try not to create conflicts as much as possible, but if you want to take the safest minimal route it would be just to create a new note with a new uuid.

from standardnotes-fs.

tannercollin avatar tannercollin commented on May 31, 2024

Okay @ogourment this should be fixed in a5ae5df. Can you please update, backup, and test conflicts thoroughly in both directions?

Thanks.

from standardnotes-fs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.