Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

fix: collapsed parent node disappears when expand

victorbrambatib7492c1c5579
diff --git a/src/utils/getOutgoers.ts b/src/utils/getOutgoers.ts
index eb35c494..6d861ea6 100644
--- a/src/utils/getOutgoers.ts
+++ b/src/utils/getOutgoers.ts
@@ -6,9 +6,14 @@ export const getOutgoers = (
): [NodeData[], string[]] => {
const outgoerNodes: NodeData[] = [];
const matchingNodes: string[] = [];
-
const runner = (nodeId: string) => {
const outgoerIds = edges.filter(e => e.from === nodeId).map(e => e.to);
+
+ if (parent.includes(nodeId)) {
+ const initialParentNode = nodes.find(n => n.id === nodeId);
+ if (initialParentNode) outgoerNodes.push(initialParentNode);
+ }
+
const nodeList = nodes.filter(n => {
if (parent.includes(n.id) && !matchingNodes.includes(n.id))
matchingNodes.push(n.id);