From 7d2e67ec7719b4b66d203bd2be2045d0e1e8d256 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Fri, 1 Dec 2023 17:23:46 -0300 Subject: [PATCH] refactor(flowsContext.tsx): remove file name from components before creating data URI The `removeFileNameFromComponents` function is added to remove the file name from the components in the `clonedFlow` object before creating the data URI. This ensures that the file name is not included in the exported flow data. refactor(genericModal/index.tsx): fix formatting of genericModalPropsType The formatting of the `genericModalPropsType` interface is fixed to improve readability and maintain consistency with the codebase. --- src/frontend/src/contexts/flowsContext.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/contexts/flowsContext.tsx b/src/frontend/src/contexts/flowsContext.tsx index 8d7d3b6f2..ec0eaad9f 100644 --- a/src/frontend/src/contexts/flowsContext.tsx +++ b/src/frontend/src/contexts/flowsContext.tsx @@ -33,6 +33,7 @@ import { addVersionToDuplicates, checkOldEdgesHandles, createFlowComponent, + removeFileNameFromComponents, scapeJSONParse, scapedJSONStringfy, updateEdgesHandleIds, @@ -251,9 +252,15 @@ export function FlowsProvider({ children }: { children: ReactNode }) { flowName: string, flowDescription?: string ) { + let clonedFlow = cloneDeep(flow); + removeFileNameFromComponents(clonedFlow); // create a data URI with the current flow data const jsonString = `data:text/json;chatset=utf-8,${encodeURIComponent( - JSON.stringify({ ...flow, name: flowName, description: flowDescription }) + JSON.stringify({ + ...clonedFlow, + name: flowName, + description: flowDescription, + }) )}`; // create a link element and set its properties