TypeError: Cannot read properties of null (reading 'maybeMeasure')

I get the “TypeError: Cannot read properties of null (reading ‘maybeMeasure’)” error thrown in the console, whenever I’m scrolling on the page. Seems to be related with hover tooltips (CodeMirror Tooltip Example), as it doesn’t get thrown if I remove that logic/extension.

Anyone how why this is happening?

Could it be that you’re calling repositionTooltips at a point where there are no active tooltips? It looks like there’s an issue in that function that might cause an error like this. This patch fixes that.

@marjin If the exported hoverTooltip function is calling repositionTooltips, that might be wants happening. I’m not calling repositionTooltips directly myself. I will test the patch once it’s released. Thank you!

It’s not. It’s only calling this.maybeMeasure, in contexts where this should really not be null. Do you have a stack trace of the error?

I see.


Skærmbillede 2023-09-14 kl. 14.54.42

That’s odd. This may be related to the event handling overhaul in 6.19.0 if it started showing up with that. I can’t manage to reproduce it. Any chance you can reduce this down to a simple self-contained script?

I was on version 6.17.1 and tried to upgrade to version 6.19.0, still an error. I’ll try to make a reproduction when I get the time :slight_smile:

@marijn Upgrading @codemirror/view to version 6.20.2 seems to have fixed the issue :tada: