You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So here's the issue: AfterTransactionEvents are fired before the transaction is freed, so that the developer has access to transaction-related attributes in the callback. The transaction holds a mutable reference to its associated YDoc so it can update the data inside. When you call encode_state_as_update, the function uses the provided YDoc to create a second new transaction. In doing so, it borrows YDoc again mutably, which isn't permitted because there cannot be 2 mutable references to the same element according to Rust ownership rules.
In #73, I added a way to do the same thing from the AfterTransactionEvent passed to the callback. Its generally a better idea to use the event if possible. @davidbrochart lmk if you need any additional functionality from the AfterTransactionEvent.
Key YDoc methods are inaccessible inside
observe_after_transaction
callbacks due to a double borrow. For exampleThe text was updated successfully, but these errors were encountered: