automerge-repo icon indicating copy to clipboard operation
automerge-repo copied to clipboard

allow for initial id in repo create

Open BrianHung opened this issue 1 year ago • 2 comments

Allows for specified id in repo.create.

One thing: in the conversation about pre-defined ids and about loading from binary, does automerge.from clone the document that is passed in?

I'm wondering if this allows for the following:

const copy = {
  content: new Uint8Array([133, 111, 74, 131, ...]),
  id: ...
}

const doc = am.load(copy.content)
const handle = repo.create(doc, copy.id)

so that the initial value in repo.create shares ancestry with the binary that is passed in.

BrianHung avatar Sep 24 '24 19:09 BrianHung

Nudge for this functionality! I was just about to write this PR before I saw this... Can provide a hand if needed.

adrianduke avatar Feb 01 '25 18:02 adrianduke

Feel free to jump into this discord thread: https://discord.com/channels/1200006940210757672/1287965416689238047/1288223592936374323 The main blocker is how should we handle conflicting ids.

BrianHung avatar Feb 02 '25 00:02 BrianHung