diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 90101025f..7efe4046b 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -27,6 +27,7 @@ import { import { TabsContextType, TabsState } from "../types/tabs"; import { addVersionToDuplicates, + checkOldEdgesHandles, scapeJSONParse, scapedJSONStringfy, updateEdgesHandleIds, @@ -154,8 +155,10 @@ export function TabsProvider({ children }: { children: ReactNode }) { function processFlowEdges(flow: FlowType) { if (!flow.data || !flow.data.edges) return; - const newEdges = updateEdgesHandleIds(flow.data); - flow.data.edges = newEdges; + if (checkOldEdgesHandles(flow.data.edges)) { + const newEdges = updateEdgesHandleIds(flow.data); + flow.data.edges = newEdges; + } flow.data.edges.forEach((edge) => { edge.className = ""; edge.style = { stroke: "#555" }; diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index 3e1484752..65720bc23 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -297,7 +297,7 @@ export function scapeJSONParse(json: string): any { } // this function receives an array of edges and return true if any of the handles are not a json string -export function checkEdgesHandles(edges: Edge[]): boolean { +export function checkOldEdgesHandles(edges: Edge[]): boolean { return edges.some( (edge) => !edge.sourceHandle ||