Sounds non-optimal not to save the nodes/marks. Much easier to just to use a NodeView to store local data and then not displaying anything if user is not the local user.
But yeah, don’t think there’s any specific Yjs way to do that. The whole document is synced between all clients without separating it into parts. You can, of course, use subdocuments but that is a bit of overkill.
Thanks for the response, sorry for the late reply!
I tried implementing such a thing, but there’s a big issue with that solution. When I hide the data from one user, the “hidden” nodes override each other, and it creates wrong behavior when 2 clients use nodes at the same location. There’s also a problem when merging 2 clients using indexedDB, which sometimes duplicates an entire paragraph.
We’ll try to debug a bit the Prosemirror->YJS flow, and will try to understand if there’s an easy workaround for us without using subdocuments. Is there any other way that you thought about?
Weird, they shouldn’t override each other. Oh yeah you are removing them with DOMSerializer? Just sync a dummy node with empty data (or marks with random uuid so that they won’t automatically merge). I think this is just an engineering problem with your ProseMirror & Yjs integration.
I’m not sure what’s the exact “data layer” you mean, since currently tiptap-collaboration extension might be the one handling it for us. I opened a PR in y-prosemirror that allows passing a meta, in order to ignore the relevant mutations.