diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 6190a6e56..88f5005fe 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -52,7 +52,7 @@ const TabsContextInitialValue: TabsContextType = { isBuilt: false, setIsBuilt: (state: boolean) => {}, hardReset: () => {}, - saveFlow: async (flow: FlowType) => {}, + saveFlow: async (flow: FlowType, silent?: boolean) => {}, lastCopiedSelection: null, setLastCopiedSelection: (selection: any) => {}, tabsState: {}, @@ -588,13 +588,15 @@ export function TabsProvider({ children }: { children: ReactNode }) { }); } - async function saveFlow(newFlow: FlowType) { + async function saveFlow(newFlow: FlowType, silent?: boolean) { try { // updates flow in db const updatedFlow = await updateFlowInDatabase(newFlow); if (updatedFlow) { // updates flow in state - setSuccessData({ title: "Changes saved successfully" }); + if (!silent) { + setSuccessData({ title: "Changes saved successfully" }); + } setFlows((prevState) => { const newFlows = [...prevState]; const index = newFlows.findIndex((flow) => flow.id === newFlow.id); diff --git a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx index 73b322d16..beef5a201 100644 --- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx @@ -168,7 +168,7 @@ export default function Page({ let updatedSeconds = prevSeconds + 1; if (updatedSeconds % 30 === 0) { - saveFlow(flow); + saveFlow(flow, true); updatedSeconds = 0; } diff --git a/src/frontend/src/types/tabs/index.ts b/src/frontend/src/types/tabs/index.ts index 4c5b99dd7..a06b514a4 100644 --- a/src/frontend/src/types/tabs/index.ts +++ b/src/frontend/src/types/tabs/index.ts @@ -2,7 +2,7 @@ import { tweakType } from "../components"; import { FlowType } from "../flow"; export type TabsContextType = { - saveFlow: (flow: FlowType) => Promise; + saveFlow: (flow: FlowType, silent?: boolean) => Promise; save: () => void; tabId: string; isLoading: boolean;