From 95767c6594e320ca6af3e69145bca45d461532e7 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Wed, 13 Sep 2023 17:57:00 -0300 Subject: [PATCH] fix(formModal): import processFlow function from reactflowUtils to fix compilation error refactor(formModal): replace the usage of processFLow function with processFlow function to correctly process the flow object --- src/frontend/src/modals/formModal/index.tsx | 4 ++-- src/frontend/src/utils/reactflowUtils.ts | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/modals/formModal/index.tsx b/src/frontend/src/modals/formModal/index.tsx index 2982b8738..f71939a2d 100644 --- a/src/frontend/src/modals/formModal/index.tsx +++ b/src/frontend/src/modals/formModal/index.tsx @@ -27,7 +27,7 @@ import { AuthContext } from "../../contexts/authContext"; import { TabsContext } from "../../contexts/tabsContext"; import { getBuildStatus } from "../../controllers/API"; import { TabsState } from "../../types/tabs"; -import { validateNodes } from "../../utils/reactflowUtils"; +import { validateNodes,processFlow } from "../../utils/reactflowUtils"; export default function FormModal({ flow, @@ -368,7 +368,7 @@ export default function FormModal({ tabsState[flow.id].formKeysData.template ); sendAll({ - ...reactFlowInstance?.toObject()!, + ... processFlow(reactFlowInstance?.toObject()!), inputs: inputs!, chatHistory, name: flow.name, diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index 1fd794140..7a9cf2b02 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -861,14 +861,13 @@ export function expandGroupNode( ReactFlowInstance.setEdges(edges); } -export function processFLow(FlowObject: ReactFlowJsonObject) { +export function processFlow(FlowObject: ReactFlowJsonObject) { let clonedFLow = _.cloneDeep(FlowObject); clonedFLow.nodes.forEach((node: NodeType) => { - if (node.type === "groupNode") { - processFLow(node.data.node!.flow!.data!); + if (node.data.node?.flow) { + processFlow(node.data.node!.flow!.data!); ungroupNode(node.data, clonedFLow); } }); - console.log(clonedFLow); return clonedFLow; }