Merging 2 docs with different histories (excluding Text/Array)

@erin Erin Masatsugu
Wed, 12 Nov 2025 20:50:36 +0000

Ah ok so I think I need to rephrase my question:

Still assuming I don’t use Array or Text fields –

With respect to offline editing, merging changes from 2 docs with entirely different histories has the same limitations as merging 2 docs with a shared history that have since diverged?

      const clientDoc = new Y.Doc()
      clientDoc.getMap('m').set('x', 1)
      clientDoc.getMap('m').set('x', 2)

      const serverDoc = new Y.Doc()
      // It actually doesn't matter which of these 2 ways serverDoc gets populated
      // Y.applyUpdate(serverDoc, Y.encodeStateAsUpdate(clientDoc))
      // serverDoc.getMap('m').set('x', 2)

      clientDoc.getMap('m').set('x', 3) // op A
      serverDoc.getMap('m').delete('x') // op B

      // At this point, op A and op B are treated as concurrent so when merging the 2 docs,
      // the conflict is randomly/arbitrarily resolved?