Merge branch 'dev' into bugfix-eventprop

This commit is contained in:
Cristhian Zanforlin Lousa 2023-08-03 15:30:39 -03:00
commit 75e25ad67f
2 changed files with 10 additions and 7 deletions

View file

@ -1,5 +1,5 @@
import _ from "lodash";
import { Connection, ReactFlowInstance } from "reactflow";
import { Connection, Edge, ReactFlowInstance } from "reactflow";
import { APITemplateType } from "../types/api";
import { FlowType, NodeType } from "../types/flow";
import { cleanEdgesType } from "../types/utils/reactflowUtils";
@ -240,3 +240,12 @@ export function handleKeyDown(e: React.KeyboardEvent<HTMLInputElement>, inputVal
e.stopPropagation();
}
};
export function getConnectedNodes(
edge: Edge,
nodes: Array<NodeType>
): Array<NodeType> {
const sourceId = edge.source;
const targetId = edge.target;
return nodes.filter((node) => node.id === targetId || node.id === sourceId);
}

View file

@ -65,7 +65,6 @@ import {
XCircle,
Zap,
} from "lucide-react";
import { Edge, Node } from "reactflow";
import { AirbyteIcon } from "../icons/Airbyte";
import { AnthropicIcon } from "../icons/Anthropic";
import { BingIcon } from "../icons/Bing";
@ -277,8 +276,3 @@ export const nodeIconsLucide = {
MessageSquare,
MoreHorizontal,
};
export function getConnectedNodes(edge: Edge, nodes: Array<Node>): Array<Node> {
const sourceId = edge.source;
const targetId = edge.target;
return nodes.filter((node) => node.id === targetId || node.id === sourceId);
}