From a1c902f49993d81956194870f0982ebd18ab1bef Mon Sep 17 00:00:00 2001 From: Steven Roussey Date: Thu, 11 Apr 2024 09:16:30 -0700 Subject: [PATCH] [web] fix: post merge cleanup --- packages/web/src/RunGraphFlow.tsx | 11 ++++------- packages/web/src/layout.ts | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/web/src/RunGraphFlow.tsx b/packages/web/src/RunGraphFlow.tsx index 80e00df..267afbd 100644 --- a/packages/web/src/RunGraphFlow.tsx +++ b/packages/web/src/RunGraphFlow.tsx @@ -133,7 +133,6 @@ function doNodeLayout( function listenToTask( task: Task, setNodes: Dispatch[]>>, - edges: Edge[], setEdges: Dispatch> ) { task.on("progress", (progress, progressText) => { @@ -209,7 +208,7 @@ function listenToTask( ); }); if (task.isCompound) { - listenToGraphTasks(task.subGraph, setNodes, edges, setEdges); + listenToGraphTasks(task.subGraph, setNodes, setEdges); task.on("regenerate", () => { // console.log("Node regenerated", task.config.id); setNodes((nodes: Node[]) => { @@ -223,7 +222,7 @@ function listenToTask( connectable: false, }) as Node ); - listenToGraphTasks(task.subGraph, setNodes, edges, setEdges); + listenToGraphTasks(task.subGraph, setNodes, setEdges); let returnNodes = nodes.filter((n) => n.parentId !== task.config.id); // remove old children returnNodes = [...returnNodes, ...children]; // add new children returnNodes = sortNodes(returnNodes); // sort all nodes (parent, children, parent, children, ...) @@ -236,12 +235,11 @@ function listenToTask( function listenToGraphTasks( graph: TaskGraph, setNodes: Dispatch[]>>, - edges: Edge[], setEdges: Dispatch> ) { const nodes = graph.getNodes(); for (const node of nodes) { - listenToTask(node, setNodes, edges, setEdges); + listenToTask(node, setNodes, setEdges); } } @@ -270,7 +268,6 @@ export const RunGraphFlow: React.FC<{ const { fitView } = useReactFlow(); useEffect(() => { - const id: Timer | null = null; if (shouldLayout) { doNodeLayout(setNodes, setEdges); setTimeout(() => { @@ -303,7 +300,7 @@ export const RunGraphFlow: React.FC<{ }; }) ); - listenToGraphTasks(graph, setNodes, edges, setEdges); + listenToGraphTasks(graph, setNodes, setEdges); } }, [graph, setNodes, setEdges, graphRef.current]); diff --git a/packages/web/src/layout.ts b/packages/web/src/layout.ts index 35e1fbe..8a8e98e 100644 --- a/packages/web/src/layout.ts +++ b/packages/web/src/layout.ts @@ -216,5 +216,5 @@ export function computeLayout( } } - return returnNodes.toReversed().map((node) => ({ ...node })); + return returnNodes.reverse().map((node) => ({ ...node })); }