pycrdt
pycrdt copied to clipboard
Missing transaction in Python event
Description
The API of Yjs for event lists an attribute transaction to events. That attribute is defined in Rust but not accessible in Python as not listed in the slots.
Reproduce
In [1]: from pycrdt import Array, Doc, Map, Text
In [2]: text = Text()
...: array = Array()
...: map_ = Map()
...: Doc(
...: {
...: "text": text,
...: "array": array,
...: "map": map_,
...: }
...: )
...: events = []
In [3]: def callback(event):
...: print(event)
...: print(event.transaction)
In [4]: sub0 = text.observe(callback) # noqa: F841
...: sub1 = array.observe(callback) # noqa: F841
...: sub2 = map_.observe(callback) # noqa: F841
...: with text.doc.transaction():
...: text += "hello"
...: text += " world"
...: array.append(1)
...: map_["foo"] = "bar"
This will failed.
Expected behavior
No failure
Context
Version 0.10.9
I wouldn't label it as a bug but as a feature request. Would you like to open a PR?