What’s broken?
On table hover/mouse-move the editor intermittently throws:
- Chrome:
Cannot read properties of undefined (reading 'id')
- Firefox:
can't access property "id", this.state.block is undefined
Both from TableHandles.ts:301, function querySelector.
Repro notes
Happens on documents containing tables when the hovered table block is cleared while the handles are being positioned. Non-fatal, the editor keeps working, but it surfaces as an uncaught window.onerror.
What did you expect to happen?
No console error.
Steps to reproduce
I haven't found a reliable manual repro this shows up in our production error reporting, not from a known click path. So I'm reporting it as a latent unsafe access with a clear throw site rather than a sequence of steps.
Throw site — TableHandles.ts:301:
const hideHandles =
this.state?.block.id !== tableBlock.id || ...
The optional chain guards this.state but not this.state.block, so this throws whenever this.state is set while this.state.block is undefined.
Likely how block becomes undefined (unconfirmed — I couldn't trigger it on demand): update() does
this.state.block = this.editor.getBlock(this.state.block.id)!;
and getBlock can return undefined (the ! hides it) when the table block was removed/replaced by a doc update. That leaves state defined with block undefined; the next mouseMove hits line 301.
Suggested fix
this.state?.block?.id !== tableBlock.id
BlockNote version
v0.51.4
Environment
Firefox 150.0, Chrome 148.0
Additional context
No response
Contribution
Sponsor
What’s broken?
On table hover/mouse-move the editor intermittently throws:
Cannot read properties of undefined (reading 'id')can't access property "id", this.state.block is undefinedBoth from TableHandles.ts:301, function querySelector.
Repro notes
Happens on documents containing tables when the hovered table block is cleared while the handles are being positioned. Non-fatal, the editor keeps working, but it surfaces as an uncaught
window.onerror.What did you expect to happen?
No console error.
Steps to reproduce
I haven't found a reliable manual repro this shows up in our production error reporting, not from a known click path. So I'm reporting it as a latent unsafe access with a clear throw site rather than a sequence of steps.
Throw site —
TableHandles.ts:301:The optional chain guards
this.statebut notthis.state.block, so this throws wheneverthis.stateis set whilethis.state.blockisundefined.Likely how
blockbecomes undefined (unconfirmed — I couldn't trigger it on demand):update()doesand
getBlockcan returnundefined(the!hides it) when the table block was removed/replaced by a doc update. That leavesstatedefined withblockundefined; the nextmouseMovehits line 301.Suggested fix
BlockNote version
v0.51.4
Environment
Firefox 150.0, Chrome 148.0
Additional context
No response
Contribution
Sponsor