From 827e5ecbafbeff21879286a3459217b7eff536b7 Mon Sep 17 00:00:00 2001 From: RohitR311 Date: Sat, 21 Dec 2024 23:04:44 +0530 Subject: [PATCH] feat: reset data based on current interpretation log state --- src/components/molecules/InterpretationLog.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 99b9fc8b..227e621c 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -35,7 +35,7 @@ export const InterpretationLog: React.FC = ({ isOpen, se const { width } = useBrowserDimensionsStore(); const { socket } = useSocketStore(); - const { currentWorkflowActionsState, notify } = useGlobalInfoStore(); + const { currentWorkflowActionsState, shouldResetInterpretationLog, notify } = useGlobalInfoStore(); const toggleDrawer = (newOpen: boolean) => (event: React.KeyboardEvent | React.MouseEvent) => { if ( @@ -94,12 +94,13 @@ export const InterpretationLog: React.FC = ({ isOpen, se setCustomValue(event.target.value); }; - const handleReset = () => { - setLog(''); - setTableData([]); - setBinaryData(null); - notify("success", t('interpretation_log.notifications.reset_success')); - }; + useEffect(() => { + if (shouldResetInterpretationLog) { + setLog(''); + setTableData([]); + setBinaryData(null); + } + }, [shouldResetInterpretationLog]); useEffect(() => { socket?.on('log', handleLog);