removed legacy function save

This commit is contained in:
anovazzi1 2023-09-27 14:04:36 -03:00
commit d73a69dd3d
3 changed files with 0 additions and 27 deletions

View file

@ -388,7 +388,6 @@ export default function ParameterComponent({
suffixes={data.node?.template[name].suffixes} suffixes={data.node?.template[name].suffixes}
onFileChange={(filePath: string) => { onFileChange={(filePath: string) => {
data.node!.template[name].file_path = filePath; data.node!.template[name].file_path = filePath;
save();
}} }}
></InputFileComponent> ></InputFileComponent>
</div> </div>

View file

@ -36,7 +36,6 @@ import { typesContext } from "./typesContext";
const uid = new ShortUniqueId({ length: 5 }); const uid = new ShortUniqueId({ length: 5 });
const TabsContextInitialValue: TabsContextType = { const TabsContextInitialValue: TabsContextType = {
save: () => {},
tabId: "", tabId: "",
setTabId: (index: string) => {}, setTabId: (index: string) => {},
isLoading: true, isLoading: true,
@ -101,29 +100,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
return newNodeId.current; return newNodeId.current;
} }
function save() {
// added clone deep to avoid mutating the original object
let Saveflows = _.cloneDeep(flows);
if (Saveflows.length !== 0) {
Saveflows.forEach((flow) => {
if (flow.data && flow.data?.nodes)
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
Object.keys(node.data.node.template).forEach((key) => {
if (node.data.node.template[key].type === "file") {
node.data.node.template[key].content = null;
node.data.node.template[key].value = "";
}
});
});
});
window.localStorage.setItem(
"tabsData",
JSON.stringify({ tabId, flows: Saveflows, id })
);
}
}
function refreshFlows() { function refreshFlows() {
setIsLoading(true); setIsLoading(true);
getTabsDataFromDB().then((DbData) => { getTabsDataFromDB().then((DbData) => {
@ -640,7 +616,6 @@ export function TabsProvider({ children }: { children: ReactNode }) {
tabId, tabId,
setTabId, setTabId,
flows, flows,
save,
incrementNodeId, incrementNodeId,
removeFlow, removeFlow,
addFlow, addFlow,

View file

@ -3,7 +3,6 @@ import { FlowType } from "../flow";
export type TabsContextType = { export type TabsContextType = {
saveFlow: (flow: FlowType, silent?: boolean) => Promise<void>; saveFlow: (flow: FlowType, silent?: boolean) => Promise<void>;
save: () => void;
tabId: string; tabId: string;
isLoading: boolean; isLoading: boolean;
setTabId: (index: string) => void; setTabId: (index: string) => void;