Skip to content

Commit 2063352

Browse files
authored
Fix error on collapse for node with no links (#293)
1 parent 15ad872 commit 2063352

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/graph/collapse.helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function computeNodeDegree(nodeId, linksMatrix = {}) {
9797
* @memberof Graph/collapse-helper
9898
*/
9999
function getTargetLeafConnections(rootNodeId, linksMatrix = {}, { directed }) {
100-
const rootConnectionsNodesIds = Object.keys(linksMatrix[rootNodeId]);
100+
const rootConnectionsNodesIds = linksMatrix[rootNodeId] ? Object.keys(linksMatrix[rootNodeId]) : [];
101101

102102
return rootConnectionsNodesIds.reduce((leafConnections, target) => {
103103
if (_isLeaf(target, linksMatrix, directed)) {

0 commit comments

Comments
 (0)