From f7b524060acddd5fea0e8c38c28e5b11470432d0 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 22 Aug 2024 05:42:42 +0530 Subject: [PATCH] feat: pass log in dependency array --- src/components/molecules/InterpretationLog.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/molecules/InterpretationLog.tsx b/src/components/molecules/InterpretationLog.tsx index 296acc97..43a6646c 100644 --- a/src/components/molecules/InterpretationLog.tsx +++ b/src/components/molecules/InterpretationLog.tsx @@ -37,14 +37,14 @@ export const InterpretationLog = () => { setLog((prevState) => prevState + '\n' + `[${new Date().toLocaleString()}] ` + msg); } scrollLogToBottom(); - }, [scrollLogToBottom]); + }, [log, scrollLogToBottom]); const handleSerializableCallback = useCallback((data: string) => { setLog((prevState) => prevState + '\n' + '---------- Serializable output data received ----------' + '\n' + JSON.stringify(data, null, 2) + '\n' + '--------------------------------------------------'); scrollLogToBottom(); - }, [scrollLogToBottom]); + }, [log, scrollLogToBottom]); const handleBinaryCallback = useCallback(({ data, mimetype }: any) => { setLog((prevState) => @@ -52,7 +52,7 @@ export const InterpretationLog = () => { + `mimetype: ${mimetype}` + '\n' + `data: ${JSON.stringify(data)}` + '\n' + '------------------------------------------------'); scrollLogToBottom(); - }, [scrollLogToBottom]); + }, [log, scrollLogToBottom]); useEffect(() => { socket?.on('log', handleLog);