BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

TypeError: Cannot read properties of undefined (reading 'colIndex') when using table handles in BlockNote

Open TtBJSH opened this issue 10 months ago • 3 comments

Description

When using BlockNote with table handles enabled, I frequently encounter the following error: TypeError: Cannot read properties of undefined (reading 'colIndex') at HTMLDivElement.<anonymous>

This error occurs randomly when interacting with tables in the editor.

Environment

  • "@blocknote/react": "^0.22.0"
  • "react": "^18.0.0"
  • Chrome Version: 132.0.6834.160 (Official Build) (64-bit)

Code Example

// Editor component

<BlockNoteView
    editor={editor}
    theme="light"
    onChange={handleChange}
    emojiPicker={false}
    slashMenu={false}
    editable={!readOnly}
    formattingToolbar={false}
    tableHandles={true}
/>

Steps to Reproduce

  1. Create a table in the editor
  2. Enable table handles
  3. Interact with the table (e.g., selecting cells, adding/removing rows/columns)
  4. The error occurs randomly during these interactions

Expected Behavior Table handles should work smoothly without throwing undefined property errors.

Additional Context

  • The error seems to be related to the table handles feature
  • It occurs intermittently and is hard to reproduce consistently
  • The editor still functions but the error appears in the console

Would appreciate any help in resolving this issue or guidance on proper configuration of table handles.

TtBJSH avatar Feb 03 '25 06:02 TtBJSH

same error when deleting the last cell of a table

"@blocknote/react": "^0.22.0" "react": "^19.0.0" Chrome Version: 132.0.6834.160 (Official Build) (64-bit)

Also we got this:

TypeError: Cannot read properties of undefined (reading 'getBoundingClientRect')
    at ea.update (https://dikaio.localdev:3000/_next/static/chunks/59a4e_%40blocknote_core_dist_blocknote_9fc2ed.js:10185:45)
    at EditorView.updatePluginViews (https://dikaio.localdev:3000/_next/static/chunks/a2f35_prosemirror-view_dist_index_e647c2.js:4900:51)
    at EditorView.updateStateInner (https://dikaio.localdev:3000/_next/static/chunks/a2f35_prosemirror-view_dist_index_e647c2.js:4859:14)
    at EditorView.updateState (https://dikaio.localdev:3000/_next/static/chunks/a2f35_prosemirror-view_dist_index_e647c2.js:4795:14)
    at ye.dispatchTransaction (https://dikaio.localdev:3000/_next/static/chunks/1205e_%40tiptap_core_dist_index_57da49.js:4561:19)
    at EditorView.dispatch (https://dikaio.localdev:3000/_next/static/chunks/a2f35_prosemirror-view_dist_index_e647c2.js:5098:54)
    at Object.method [as command] (https://dikaio.localdev:3000/_next/static/chunks/1205e_%40tiptap_core_dist_index_57da49.js:177:26)
    at gn (https://dikaio.localdev:3000/_next/static/chunks/59a4e_%40blocknote_core_dist_blocknote_9fc2ed.js:7523:16)
    at co.updateBlock (https://dikaio.localdev:3000/_next/static/chunks/59a4e_%40blocknote_core_dist_blocknote_9fc2ed.js:11044:16)
    at onClick (https://dikaio.localdev:3000/_next/static/chunks/ff866_%40blocknote_react_dist_blocknote-react_fa7240.js:2759:15)
    at handleEvent (https://dikaio.localdev:3000/_next/static/chunks/08b5e__pnpm_9e799f._.js:47968:31)
    at processDispatchQueue (https://dikaio.localdev:3000/_next/static/chunks/d6168_next_dist_compiled_react-dom_612766._.js:8501:25)
    at https://dikaio.localdev:3000/_next/static/chunks/d6168_next_dist_compiled_react-dom_612766._.js:8798:13
    at batchedUpdates$1 (https://dikaio.localdev:3000/_next/static/chunks/d6168_next_dist_compiled_react-dom_612766._.js:2090:44)
    at dispatchEventForPluginEventSystem (https://dikaio.localdev:3000/_next/static/chunks/d6168_next_dist_compiled_react-dom_612766._.js:8583:9)
    at dispatchEvent (https://dikaio.localdev:3000/_next/static/chunks/d6168_next_dist_compiled_react-dom_612766._.js:10685:37)
    at dispatchDiscreteEvent (https://dikaio.localdev:3000/_next/static/chunks/d6168_next_dist_compiled_react-dom_612766._.js:10667:64)

dikaioai avatar Feb 03 '25 18:02 dikaioai

@nperez0111 do you think #1446 will address this?

YousefED avatar Feb 24 '25 11:02 YousefED

Hard to say without a full reproduction, but I did partially rewrite the table handle behavior, so I think it should address this.

nperez0111 avatar Feb 24 '25 11:02 nperez0111

Closing this as a lot of related code has changed. Please open a new issue with reproducible example if it still occurs

YousefED avatar Jun 19 '25 19:06 YousefED