diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index 059fdfb81..8005a8a30 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -86,6 +86,7 @@ export default function GenericNode({ deleteNode(data.id); return; } + console.log(data) return (
{ - 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( + if (Saveflows.length !== 0){ + Saveflows.forEach((flow) => { + if(flow.data && flow.data?.nodes) flow.data?.nodes.forEach((node) => { + console.log(node.data.type) + //looking for file fields to prevent saving the content and breaking the flow for exceeding the the data limite for local storage + 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 = null; + node.data.node.template[key].value = ""; + + } + }) + }) + }) + window.localStorage.setItem( "tabsData", JSON.stringify({ tabIndex, flows:Saveflows, id}) ); + } } useEffect(() => { //get tabs locally saved let cookie = window.localStorage.getItem("tabsData"); - console.log(cookie) if (cookie && Object.keys(templates).length > 0) { let cookieObject: LangFlowState = JSON.parse(cookie); cookieObject.flows.forEach((flow) => {