iVis-at-Bilkent / cytoscape.js-fcose

fCoSE: a fast Compound Spring Embedder
MIT License
145 stars 26 forks source link

error when no nodes in graph #23

Closed johnha closed 4 years ago

johnha commented 4 years ago

FYI - I am using in vue/ reactive graph. An error was introduced in v1.2.3 when there are no nodes in the graph. Error when no decendants reported in the auxilliary package:

Specifically: var currentNode = topMostNodes[0]; var childrenOfCurrentNode = cy.collection(); childrenOfCurrentNode.merge(currentNode).merge(currentNode.descendants());

I can see some code removed that checked to return if no elements in main module.

Downgraded to v1.2.2 and working correctly.

thanks

hasanbalci commented 4 years ago

@johnha Thanks for the notice. There is a closed issue #22 related to this problem. We fixed it in the unstable branch and it will be available with the next release. For now, you can either use v1.2.2 if you're not dealing with hidden nodes (because v1.2.3 fixes a bug related to hidden nodes), or you can use v1.2.3 with a check prior to running the layout (if number of nodes > 0, then run layout).

johnha commented 4 years ago

great. many thanks for the quick response! a great library!