fix crash when upload large file, not saving files on browser storage (#362)

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-05-26 22:38:15 -03:00 committed by GitHub
commit ee041f4d91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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(() => {