i wanna delete a node below the node i clicked where the scenario will be like the node will have two handle in the bottom of true and false where the true has separate nodes below it and the false also the same. if i click the node and say true handle means only the node and its child in true handle nodes must be deleted with edges but the false node child must be connected to the selected nodes parent node.

Reference Image

const onDeleteSave = () => { const targetNode = flow.use.rfInstance!.getNode(nodeProps.id)!; const edges = getConnectedEdges( [targetNode], flow.use.rfInstance!.getEdges(), ); const sourceEdge = edges.find(e => e.target === nodeProps.id); let path_id: string | [string, string] = ''; if (data?.settings) { path_id = flow.use.toolBox!.getBinaryPathId(whichPath, data) as any; } const nodesInPath = (path: string | string[]) => { return flow.use .rfInstance!.getNodes() .filter(n => { if ('path_id' in n.data || 'routeId' in n.data) { switch (typeof path) { case 'string': { if (n.data.path_id === path || n.data.routeId === path) { return n; } break; } case 'object': { if ( path.includes(n.data.path_id) || path.includes(n.data.routeId) ) { return n; } break; } } } }) .map(n => n.id); }; const whichNodeToConnect = nodesInPath( flow.use.toolBox!.getBinaryPathId( whichPath === 'true_path' ? 'false_path' : 'true_path', data, ), ); let nodeToConnect = {}; if (whichPath === 'both_path') { nodeToConnect = whichNodeToConnect[whichNodeToConnect.length]; } else { nodeToConnect = whichNodeToConnect[0]!; } const edgesToDeleteId = flow.use.toolBox!.getBinaryPathId(whichPath, data); const edgesToDelete = flow.use.rfInstance ?.getEdges() .filter( e => edgesToDeleteId.includes(e.source) || edgesToDeleteId.includes(e.target), ); flow.use.actions!.deleteAction({ data, flow, nextEdge: nodeToConnect as any, nodeId: nodeProps.id, flowId: param.id!, type: 'binary', nodeIds: nodesInPath(path_id)!, path: whichPath, }); }; 

Related questions 820 How to fix missing dependency warning when using useEffect React Hook 0 React flow: custom group node example 4 React-Flow: Can you pass props to a custom node in React-Flow? Related questions 820 How to fix missing dependency warning when using useEffect React Hook 0 React flow: custom group node example 4 React-Flow: Can you pass props to a custom node in React-Flow? 0 How to make edges appear above nodes in React Flow? 0 How to search string in nested object and update the property for all child and parent 2 Traverse to child nodes and find property(upto n levels) Load 3 more related questions Show fewer related questions

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.