From abbec747c4a999cf648a3a960dbb9cb3e9191179 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 8 Oct 2024 17:39:11 +0530 Subject: [PATCH] feat: fetch workflow every time id changes --- src/components/organisms/RightSidePanel.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index 4f440830..d8e27d6c 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -61,6 +61,20 @@ export const RightSidePanel: React.FC = ({ onFinishCapture //setRecordingLength(data.workflow.length); }, [workflow]) + useEffect(() => { + // fetch the workflow every time the id changes + if (id) { + fetchWorkflow(id, workflowHandler); + } + // fetch workflow in 15min intervals + let interval = setInterval(() => { + if (id) { + fetchWorkflow(id, workflowHandler); + } + }, (1000 * 60 * 15)); + return () => clearInterval(interval) + }, [id]); + const handleTextLabelChange = (id: number, label: string, listId?: number, fieldKey?: string) => { if (listId !== undefined && fieldKey !== undefined) { // Prevent editing if the field is confirmed