feat: pass log in dependency array
This commit is contained in:
@@ -37,14 +37,14 @@ export const InterpretationLog = () => {
|
|||||||
setLog((prevState) => prevState + '\n' + `[${new Date().toLocaleString()}] ` + msg);
|
setLog((prevState) => prevState + '\n' + `[${new Date().toLocaleString()}] ` + msg);
|
||||||
}
|
}
|
||||||
scrollLogToBottom();
|
scrollLogToBottom();
|
||||||
}, [scrollLogToBottom]);
|
}, [log, scrollLogToBottom]);
|
||||||
|
|
||||||
const handleSerializableCallback = useCallback((data: string) => {
|
const handleSerializableCallback = useCallback((data: string) => {
|
||||||
setLog((prevState) =>
|
setLog((prevState) =>
|
||||||
prevState + '\n' + '---------- Serializable output data received ----------' + '\n'
|
prevState + '\n' + '---------- Serializable output data received ----------' + '\n'
|
||||||
+ JSON.stringify(data, null, 2) + '\n' + '--------------------------------------------------');
|
+ JSON.stringify(data, null, 2) + '\n' + '--------------------------------------------------');
|
||||||
scrollLogToBottom();
|
scrollLogToBottom();
|
||||||
}, [scrollLogToBottom]);
|
}, [log, scrollLogToBottom]);
|
||||||
|
|
||||||
const handleBinaryCallback = useCallback(({ data, mimetype }: any) => {
|
const handleBinaryCallback = useCallback(({ data, mimetype }: any) => {
|
||||||
setLog((prevState) =>
|
setLog((prevState) =>
|
||||||
@@ -52,7 +52,7 @@ export const InterpretationLog = () => {
|
|||||||
+ `mimetype: ${mimetype}` + '\n' + `data: ${JSON.stringify(data)}` + '\n'
|
+ `mimetype: ${mimetype}` + '\n' + `data: ${JSON.stringify(data)}` + '\n'
|
||||||
+ '------------------------------------------------');
|
+ '------------------------------------------------');
|
||||||
scrollLogToBottom();
|
scrollLogToBottom();
|
||||||
}, [scrollLogToBottom]);
|
}, [log, scrollLogToBottom]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
socket?.on('log', handleLog);
|
socket?.on('log', handleLog);
|
||||||
|
|||||||
Reference in New Issue
Block a user