When using YJS with y-prosemirror, we’ve observed that sometimes observeDeep
is invoked with a transaction whose origin is null
, making it hard to tell what the origin is (and thus for us the userId
that triggered the transaction)
It appears this is the result of transaction cleanups. This comment block partly explains it but I dont fully understand: yjs/Transaction.js at ea4e9a0007a7d19ee913647f47b17aebd08bdef1 · yjs/yjs · GitHub
Is it safe to assume that for each transaction that observeDeep
will be called at least once, and the first invocation will always contain the origin?
document
.getXmlFragment('default')
.observeDeep((events, transaction) => {
if (transaction.origin === null) {
// This must be triggered as the result of a transaction cleanup?
}
});