format
This commit is contained in:
parent
82a8b633a6
commit
1981321b1a
1 changed files with 20 additions and 20 deletions
|
|
@ -60,29 +60,29 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
}
|
}
|
||||||
function save() {
|
function save() {
|
||||||
// added clone deep to avoid mutating the original object
|
// added clone deep to avoid mutating the original object
|
||||||
let Saveflows = _.cloneDeep(flows);
|
let Saveflows = _.cloneDeep(flows);
|
||||||
if (Saveflows.length !== 0){
|
if (Saveflows.length !== 0) {
|
||||||
Saveflows.forEach((flow) => {
|
Saveflows.forEach((flow) => {
|
||||||
if(flow.data && flow.data?.nodes) flow.data?.nodes.forEach((node) => {
|
if (flow.data && flow.data?.nodes)
|
||||||
console.log(node.data.type)
|
flow.data?.nodes.forEach((node) => {
|
||||||
//looking for file fields to prevent saving the content and breaking the flow for exceeding the the data limite for local storage
|
console.log(node.data.type);
|
||||||
Object.keys(node.data.node.template).forEach((key) => {
|
//looking for file fields to prevent saving the content and breaking the flow for exceeding the the data limite for local storage
|
||||||
console.log(node.data.node.template[key].type)
|
Object.keys(node.data.node.template).forEach((key) => {
|
||||||
if(node.data.node.template[key].type==="file"){
|
console.log(node.data.node.template[key].type);
|
||||||
console.log(node.data.node.template[key])
|
if (node.data.node.template[key].type === "file") {
|
||||||
node.data.node.template[key].content = null;
|
console.log(node.data.node.template[key]);
|
||||||
node.data.node.template[key].value = "";
|
node.data.node.template[key].content = null;
|
||||||
|
node.data.node.template[key].value = "";
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
window.localStorage.setItem(
|
window.localStorage.setItem(
|
||||||
"tabsData",
|
"tabsData",
|
||||||
JSON.stringify({ tabIndex, flows:Saveflows, id})
|
JSON.stringify({ tabIndex, flows: Saveflows, id })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
//save tabs locally
|
//save tabs locally
|
||||||
save();
|
save();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue