From 398d0036cdfd74a74721c60129722cb0133e87c8 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 8 Oct 2024 17:43:49 +0530 Subject: [PATCH] feat: socket for workflow --- src/components/organisms/RightSidePanel.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/organisms/RightSidePanel.tsx b/src/components/organisms/RightSidePanel.tsx index b1e1b222..403b00de 100644 --- a/src/components/organisms/RightSidePanel.tsx +++ b/src/components/organisms/RightSidePanel.tsx @@ -74,6 +74,16 @@ export const RightSidePanel: React.FC = ({ onFinishCapture return () => clearInterval(interval) }, [id]); + useEffect(() => { + if (socket) { + socket.on("workflow", workflowHandler); + } + + return () => { + socket?.off('workflow', workflowHandler); + } + }, [socket, workflowHandler]); + const handleTextLabelChange = (id: number, label: string, listId?: number, fieldKey?: string) => { if (listId !== undefined && fieldKey !== undefined) { // Prevent editing if the field is confirmed