In yjs demos i see that cursor information is stored as a crdt and shared.
But shouldn’t lastest value of cursor information always win? Why do we even need a crdt here?
Reason i am asking this is because I am trying to share cursor info in my coding editor app and just want to make sure that by not using a crdt for this I am not overlooking and potential bugs.
“latest value” is not well defined if there is no source of truth (e.g. in a p2p collab environment).
A CRDT can be used to compute the latest value.
The Awareness CRDT is even dumber than that. It’s only responsible for distributing messages. It can also figure out when a client is not responsive anymore. If your server provides the same functionality, you can use that instead. You don’t have to use the Awareness CRDT.
Ohk, thanks.
It makes sense to make use of the awareness object rather than writing something from scratch
But plugins like y-codemirror.next assumes that the cursor awareness is always stored inside a key called ‘cursor’ (along with some other color related properties stored inside ‘user’). Is there any way to decouple that? I have multiple editors, not sure how to store them inside a single awareness object so they play nicely with the plugins