diff --git a/langflow/frontend/src/contexts/typesContext.tsx b/langflow/frontend/src/contexts/typesContext.tsx index 664a3dcf6..d20012a84 100644 --- a/langflow/frontend/src/contexts/typesContext.tsx +++ b/langflow/frontend/src/contexts/typesContext.tsx @@ -21,6 +21,7 @@ export function TypesProvider({ children }:{children:ReactNode}) { reactFlowInstance.setNodes( reactFlowInstance.getNodes().filter((n:Node) => n.id !== idx) ); + reactFlowInstance.setEdges(reactFlowInstance.getEdges().filter((ns) => ns.source !== idx && ns.target !== idx)); } return ( { + setEdges(edges.filter((ns) => !nodes.some((n) => ns.source === n.id || ns.target === n.id))); + } return (
@@ -174,6 +178,7 @@ export default function FlowPage({ flow }:{flow:FlowType}) { connectionLineComponent={ConnectionLineComponent} onDragOver={onDragOver} onDrop={onDrop} + onNodesDelete={onDelete} > diff --git a/langflow/frontend/src/utils.ts b/langflow/frontend/src/utils.ts index 3f53b446d..c95f17834 100644 --- a/langflow/frontend/src/utils.ts +++ b/langflow/frontend/src/utils.ts @@ -315,7 +315,6 @@ export function isValidConnection( { source, target, sourceHandle, targetHandle }:Connection, reactFlowInstance:ReactFlowInstance ) { - console.log(target) if ( sourceHandle.split('|')[0] === targetHandle.split("|")[0] || sourceHandle.split('|').slice(2).some((t) => t === targetHandle.split("|")[0]) ||