diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 6576f9137..a1ad15335 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -275,16 +275,16 @@ export function TabsProvider({ children }: { children: ReactNode }) { /** * Downloads the current flow as a JSON file */ - function downloadFlow(flow: FlowType) { + function downloadFlow(flow: FlowType,flowName:string,flowDescription?:string) { // create a data URI with the current flow data const jsonString = `data:text/json;chatset=utf-8,${encodeURIComponent( - JSON.stringify(flow) + JSON.stringify({...flow, name:flowName, description:flowDescription}) )}`; // create a link element and set its properties const link = document.createElement("a"); link.href = jsonString; - link.download = `${flows.find((f) => f.id === tabId).name}.json`; + link.download = `${flowName}.json`; // simulate a click on the link element to trigger the download link.click(); diff --git a/src/frontend/src/modals/exportModal/index.tsx b/src/frontend/src/modals/exportModal/index.tsx index 236c27366..638807350 100644 --- a/src/frontend/src/modals/exportModal/index.tsx +++ b/src/frontend/src/modals/exportModal/index.tsx @@ -23,7 +23,7 @@ export default function ExportModal() { const { closePopUp } = useContext(PopUpContext); const ref = useRef(); const { setErrorData } = useContext(alertContext); - const { flows, tabId, updateFlow, downloadFlow } = useContext(TabsContext); + const { flows, tabId, updateFlow, downloadFlow,saveFlow } = useContext(TabsContext); const [isMaxLength, setIsMaxLength] = useState(false); function setModalOpen(x: boolean) { setOpen(x); @@ -80,9 +80,9 @@ export default function ExportModal() {