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.
This commit is contained in:
anovazzi1 2023-12-01 17:23:46 -03:00
commit 7d2e67ec77

View file

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