"Cannot read property 'x' of undefined" error when use smart-routing

Author: stanislaw-grinCreated Aug 27, 2020Updated Mar 21, 2025
Labelsbugneeds investigationshowcases a cool project :P

I'm using v6.2.0 and in the process of making some kind of DB schema diagram that users can view, edit, add/modify/delete tables/columns etc. Here is how it looks like:

image

Currently I have a strange issue after I started to use smart-routing for links. Time to time I receive Cannot read property 'x' of undefined error (on screenshot below), sometimes right after render, and sometimes when trying to drag some node. No strong steps to reproduce this behavior (tried to find out it, but no luck). And sometimes I see another error Cannot read property '26' of undefined (or any other number) caused at pathfinding/src/core/Grid.js.Grid.getNodeAt (Grid.js:84).

image

I saw issues with similar problem, but any solution seems can't help me. https://github.com/projectstorm/react-diagrams/issues/433 Here suggestion is to add engine.recalculatePortsVisually(), but there is no such method in current version of library. Also it does not related to dropping nodes from sidebar. https://github.com/projectstorm/react-diagrams/issues/214

Source: projectstorm/react-diagrams