Remix.run Logo
borlando 14 hours ago

Interesting approach. How does the Yjs sync work when two people edit the same node in the mind map view? Do you handle conflicts at the node level or at the text level?

havlenao 13 hours ago | parent | next [-]

We handle it at the text level using Yjs CRDTs. Each node content is a Y.XmlFragment, so when two people type in the same node at the same time, Yjs merges the changes character by character.Its similar to how Google Docs works. No conflicts, no overwrites.

The tree structure is managed by a separate Yjs data structure. So if one person moves a node while another edits its text.

The sync layer is Hocuspocus (WebSocket server) on top of a NestJS backend. Documents are persisted to PostgreSQL and synced to all connected clients. When you go offline, changes queue in IndexedDB and merge automatically when you reconnect.

The mind map view and text editor view share the same Yjs document. Edits in one view appear instantly in the other, even across different users.

13 hours ago | parent | prev | next [-]
[deleted]
14 hours ago | parent | prev | next [-]
[deleted]
13 hours ago | parent | prev [-]
[deleted]