Uncaught TypeError: Cannot read property 'bounds' of null

Getting the following error when trying to drag and select multiple nodes and the mouse up event is triggered when hovering outside of the canvas.

image

Any idea what might be causing this.

Dependency versions from the .lock file - image

We are not using any override of the Drag Select tool

As you can see by dragging parts outside of any sample diagram, that isn’t normal behavior.

Do you have some kind of hover or over event defined outside of the diagram’s DIV?

We don’t have kind of hover or over event defined outside of the diagram’s div.

I know the dragging behaviour is not normal but while dragging users sometimes do go over the diagram bounds. Earlier, that worked fine without any errors being raised. May have been with any new release?

No, I don’t think we’ve changed anything in our implementation there, not for years.
As I said, if you try it in any of our sample apps, there is no such behavior as you describe. And it should be easy for you to go back to a previous version, if you want to check.

If you say it worked before in your app, what else has changed?

Will check for changes in our app and check back. If it’s on our end. Will update with what caused it and close the thread for future reference. Thanks again.

The error doesn’t come up if the ScrollMode is set to Infinite.

What kinds of DiagramEvent listeners do you have? Do you if have a “ViewportBoundsChanged” one, and what does it do?

I’m wondering if the mouse is actually hovering just inside the Div/viewport, causing an autoscroll.

Yes we do have ViewportBoundsChanged event where we check the current scale and persist it in react state.

Ah, I wonder if that is interacting with the diagram unexpectedly – perhaps that changes to React state are getting back to the Diagram and interfering with the user’s operation?

But we don’t pass that react state back to gojs again. We use to set the initial scale when we come back to the diagram from any other page again (that is next time the ReactDiagram component is re-rendered).

I will try removing it and try just to be sure. Thanks.

We commented out our custom ViewportBoundsChanged handler the issue still persists.

The issue happens only for really long nodes.

What are the actualBounds of that node? What are the Diagram.documentBounds?