feat: pass log in dependency array

This commit is contained in:
karishmas6
2024-08-22 05:42:42 +05:30
parent c656b5782a
commit f7b524060a

View File

@@ -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);