swimlane/ngx-graph

Graph crashes when no links or nodes are provided

Opened this issue · 1 comments

Describe the bug
If no links or nodes are provided the error which is shown below in the screenshots is thrown.
In version 9.0.1, at least one node and one link are required. However, as we use the graph to establish relationships between nodes, providing initial links isn’t feasible, leading to an endless loop that crashes the Angular app. It would be helpful if the case of empty links or nodes were handled as it was prior to the 9.0.0 release.

To Reproduce
Steps to reproduce the behavior:

  1. Create a graph (e.g. a simple demo graph from the documentation) and provide an empty array of nodes and links
  2. Open the graph
  3. see the error above

Expected behavior
Even if an empty array of links and nodes (or only 1 node) are provided the graph should still render.

Screenshots
If applicable, add screenshots to help explain your problem.
image
image

ngx-graph version
9.0.1

@steveblue we provided a fix in #560 can we merge it?