I’ve got more informations about this danger. From another post:
And from the FAQ:
So, it seems safe if the migration function is the only place where the client ID is manually set. I think an even safer version would be to have a client ID equals to the document version. This ensures that two conflicting updates due to a migration will never have the same client ID:
function applyDocumentMigration(doc: Y.Doc) {
const clientID = doc.clientID
const version = doc.getMap().get("version")
switch (version) {
case 0:
doc.clientID = 0
// ... apply migrations from v0 to v1
case 1:
doc.clientID = 1
// ... apply migrations from v1 to v2
}
doc.clientID = clientID
}
What do you think? Am I about to do something horribly wrong? Even though I think it’s safe, the repeated warnings make me a bit anxious.