automerge / automerge-classic

A JSON-like data structure (a CRDT) that can be modified concurrently by different users, and merged again automatically.
http://automerge.org/
MIT License
14.76k stars 467 forks source link

remove limitation that merge requires different actors #471

Closed nikgraf closed 2 years ago

nikgraf commented 2 years ago

When I chatted with @ept he mentioned that the restriction is artificial and was put there to stop people accidentally misusing the API. Unfortunately it is a limitation for certain use-cases.

My use-case: I'm having an end-to-end encrypted protocol where save is leveraged to create Snapshots of the current document that are stored remotely. Now if a client has a

You can't merge the documents together. I also can imaging architectures that leverage save to place document into different storages and need to merge them.

Of course this already is an advanced use-case and could be worked around directly leveraging applyChanges.

Let me know if you think the restriction is important enough or it's fine to remove.

Note: yarn test is passing

ept commented 2 years ago

Okay, this looks good to me. Thanks @nikgraf!