When is the best time to resolve conflicts?

When is the best time to resolve conflicts?

  1. When the document is synced from the server to the client App. Using a live query?
  2. When the document is saved on the client
  3. When the document is queried, loaded into memory and used by the App

Option 3 is the most efficient and makes the most sense to me. Thoughts?

There are two types of conflicts. Or as I’ve started referring to it, there is conflict resolution and conflict prevention.

CBL 1 already does conflict prevention (your option 2.) If you try to save a doc and your base revision isn’t current anymore, the save fails with an error. It’s possible to bypass that and deliberately create a conflict, but I don’t recommend it.

CBL 2 will automatically do option 1 for you. Using CBL 1 you can do that yourself by running a query after replication. Or you can do option 3 if you want. It depends on how urgent you feel conflict resolution is.

Im using CBL 1.4. If I chose to implement option 1, is there a good way to find what documents were recently updated?

You can look at the document sequence numbers. A larger number means more recently updated.