If you pass a context (or transactionOrigin) to the transact method of DirectConnection, the context is not applied to the modifications you perform within your transaction function. So if you have, for instance, onChange hooks in your server extensions, they will not see the given context.
As a workaround, one can of course do something like
directConnection.transact((document) => {
document.transact((document) => {
// Perform actual transaction here
}, myContext)
}, myContext)
... but to me this seems unnecessary, as it would seem intuitive for the DirectConnection to take care of this. Maybe, on this line one could instead do
Description
If you pass a
context
(ortransactionOrigin
) to thetransact
method of DirectConnection, the context is not applied to the modifications you perform within your transaction function. So if you have, for instance, onChange hooks in your server extensions, they will not see the givencontext
.As a workaround, one can of course do something like
... but to me this seems unnecessary, as it would seem intuitive for the DirectConnection to take care of this. Maybe, on this line one could instead do
This way, I suppose, it would work as one expect. Let me know what you think.
And thanks for HocusPocus! It generally seems like a great backend for Y.js applications and has pretty good documentation.