From 7e8eea5e879de8ad42a42b406f9d066ac08d16fe Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Fri, 26 May 2023 22:05:47 -0300 Subject: [PATCH] fix crash when upload large file, not saving files on browser storage --- src/frontend/src/contexts/tabsContext.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 8f0832c3a..f34e1bc7a 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -50,10 +50,23 @@ export function TabsProvider({ children }: { children: ReactNode }) { return newNodeId.current; } function save() { - if (flows.length !== 0) + let Saveflows = [...flows]; + if (Saveflows.length !== 0) + Saveflows.forEach((flow) => { + if(flow.data && flow.data?.nodes) flow.data?.nodes.forEach((node) => { + console.log(node.data.type) + Object.keys(node.data.node.template).forEach((key) => { + console.log(node.data.node.template[key].type) + if(node.data.node.template[key].type==="file"){ + console.log(node.data.node.template[key]) + node.data.node.template[key].content = ""; + } + }) + }) + }) window.localStorage.setItem( "tabsData", - JSON.stringify({ tabIndex, flows, id}) + JSON.stringify({ tabIndex, flows:Saveflows, id}) ); } useEffect(() => {