Skip to content

YJS Remote Updates Clear Content After Comment Operations #1782

Closed
@Adah35

Description

@Adah35

Describe the bug
When using BlockNote with YJS collaboration and comments enabled, adding comments triggers YJS remote updates that unexpectedly clear block content, resulting in data loss. so when the block gets cleared it triggers the listeners on the server side which tries to save the empty blocks and this replaces the original content,

Environment
Socket.IO Provider: y-socket.io

To Reproduce
Minimal Reproduction

BlockNote editor with YJS collaboration
Comment system enabled
Any text content
Attempt to add a comment to selected text
Monitor editor.onChange() to observe the content clearing

Actual Behavior
When a comment is added, the following occurs:

{
  "type": "update",
  "block": {
    "id": "7e0254be-ecf9-4eb9-b782-f9e9594657ca",
    "type": "paragraph",
    "content": [],  // ❌ Content is cleared!
    "children": []
  },
  "prevBlock": {
    "content": [
      {
        "type": "text",
        "text": "code  ",
        "styles": {}
      }
    ]
  },

```  "source": { "type": "yjs-remote" }  // ❌ Remote update clears content
}


**Misc**

- Node version: 20
- Package manager: npm
- Browser: chrome browser

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions