Repository navigation
Description
What’s broken?
Summary: After upgrading from 0.46.1 to 0.49.0, an intermittent "Block doesn't have id" error fires during initial editor mount when navigating between collaborative pages.
The thrown editor's state has been observed to contain content from a different room/Y.Doc than the one the component was rendering.
Environment:
- @blocknote/{core,react,mantine,xl-pdf-exporter,server-util}: 0.49.0
- React 19, Next.js 16 (Turbopack dev), --turbo mode
- TipTap core 3.15.x, Y.js 13.6.30
- Collaboration via @hocuspocus/provider 3.4.4
Stack:
kt (internal.ts:108) — throws "Block doesn't have id"
← addNodeView in createSpec.ts:191 (createBlockSpec custom block)
← TipTap nodeview (ExtensionManager.ts:227)
← prosemirror NodeViewDesc.create
← ViewTreeUpdater.addNode → iterDeco → updateChildren (×N)
← docViewDesc → new EditorView
← Editor.createView → Editor.mount → BlockNoteEditor.mount
← BlockNoteView.tsx:295 (ref attach)
← commitAttachRef → safelyAttachRef
← reappearLayoutEffects ← React 19 Activity / Offscreen reappear path
Smoking gun: patching Editor.prototype.mount to log editor.state.doc.toJSON() at every mount captured an editor instance bound to the URL of new page B whose state contained custom blocks (type: "task", task_id: "") from page A's content. Page A and page B are different Hocuspocus rooms with independent .yjs files on disk (verified). The leak happens in-memory, on the client.
Did NOT fix it: adding key={roomId} and key={doc.guid} on the wrapping context-provider components above BlockNoteView. That suggests the leak is below the component-key boundary — most likely tied to the editor instance returned by useCreateBlockNote not being torn down before its BlockNoteView ref is reattached during a reappearLayoutEffects traversal.
What did you expect to happen?
No error
Steps to reproduce
- App with multiple collaborative pages (each is its own Y.Doc room) backed by Hocuspocus.
- Open page A (page with custom blocks created via createBlockSpec).
- Click "add new page" — UI navigates to a fresh page B, server-seeds B's Y.Doc with template binary via Hocuspocus.
- Click "apply template" — B's is_empty flag flips, parent re-renders to mount the BlockNote editor for the first time.
- ~10% of the time, the editor mount throws.
BlockNote version
0.46.2
Environment
Chrome 147, macos
Additional context
I bisected and found that https://github.com/TypeCellOS/BlockNote/releases/tag/v0.46.2 introduced the issue. Best leads from a quick scan:
- fix:
BlockNoteViewEditormismatched editable value #2357 — "BlockNoteViewEditor mismatched editable value" — modified the mount callback in BlockNoteView.tsx (which is exactly line 295 in my stack trace) and changed the deps array. - fix(ai): re-enable flipping the AIMenu when there is not enough space #2245 #2247 — AI menu repositioning (touches layout effects)
- fix(link-toolbar): prevent Enter from submitting during IME composition #2361 — IME composition handling
Contribution
- I'd be interested in contributing a fix for this issue
Sponsor
- I'm a sponsor and would appreciate if you could look into this sooner than later 💖
Activity
YousefED commentedon Apr 28, 2026
Thanks @RobinClowers. Do you think you're able to provide a clean reproducable example (e.g.: Stackblitz repro)? This would make it a lot easier to diagnose and address the underlying issue
RobinClowers commentedon Apr 28, 2026
I can definitely try to create a repro. The good news is I found a guard that prevents the issue, the bad news I'm not really sure why it works.
We were initializing BlockNoteEditor without collaboration and without content, but just doing that by itself doesn't trigger the crash. I'll continue to investigate and see if I can narrow it down.
YousefED commentedon May 1, 2026
Thanks, glad to hear you've been able to find a workaround. I'm going to close the issue now, but let me know if there's a reproducible scenario and I'll gladly reopen
RobinClowers commentedon May 1, 2026
Fair enough, I spent some time trying to build an isolated repro and wasn't able to. My best guess is that it was a partial update from our yjs server that caused it, which is probably a bug in our server implementation, rather than BlockNote.