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
This commit is contained in:
anovazzi1 2023-09-13 17:57:00 -03:00
commit 95767c6594
2 changed files with 5 additions and 6 deletions

View file

@ -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,

View file

@ -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;
}