Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DirectConnection transact context not passed to document lifecycle hooks #833

Open
raimohanska opened this issue Jun 13, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request feature request

Comments

@raimohanska
Copy link

Description

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

this.document.transact(transaction, transactionOrigin)

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.

@raimohanska raimohanska added the bug Something isn't working label Jun 13, 2024
@janthurau janthurau added enhancement New feature or request feature request and removed bug Something isn't working labels Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature request
Projects
None yet
Development

No branches or pull requests

2 participants