fix: do not sort by number of connections
diff --git a/erpnext/hr/page/organizational_chart/organizational_chart.py b/erpnext/hr/page/organizational_chart/organizational_chart.py
index 46578f3..ce84b3c 100644
--- a/erpnext/hr/page/organizational_chart/organizational_chart.py
+++ b/erpnext/hr/page/organizational_chart/organizational_chart.py
@@ -24,7 +24,6 @@
 		employee.connections = get_connections(employee.id)
 		employee.expandable = 1 if is_expandable else 0
 
-	employees.sort(key=lambda x: x['connections'], reverse=True)
 	return employees
 
 
diff --git a/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js b/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js
index bf36679..374787c 100644
--- a/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js
+++ b/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js
@@ -135,8 +135,8 @@
 			}
 		}).then(r => {
 			if (r.message.length) {
+				let expand_node = undefined;
 				let node = undefined;
-				let first_root = undefined;
 
 				$.each(r.message, (i, data) => {
 					node = new me.Node({
@@ -151,11 +151,11 @@
 						is_root: true
 					});
 
-					if (i == 0)
-						first_root = node;
+					if (!expand_node && data.connections)
+						expand_node = node;
 				});
 
-				me.expand_node(first_root);
+				me.expand_node(expand_node);
 			}
 		});
 	}