From 2fb4a2c1a32a71c41e84b2bc5c0fa3c4b3f199f9 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 13 Nov 2022 18:44:54 +0300 Subject: ESLint: configure additional plugins --- vnext/src/ui/Chat.js | 2 +- vnext/src/ui/Thread.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'vnext/src') diff --git a/vnext/src/ui/Chat.js b/vnext/src/ui/Chat.js index f7113aaa..2a3e90de 100644 --- a/vnext/src/ui/Chat.js +++ b/vnext/src/ui/Chat.js @@ -36,7 +36,7 @@ export default function Chat(props) { setChats(response.data); }).catch(console.log); } - }, []); + }, [visitor]); let onMessage = useCallback((json) => { const msg = JSON.parse(json.data); diff --git a/vnext/src/ui/Thread.js b/vnext/src/ui/Thread.js index 979ef72b..cfb67bb1 100644 --- a/vnext/src/ui/Thread.js +++ b/vnext/src/ui/Thread.js @@ -55,14 +55,6 @@ export default function Thread(props) { console.log(ex); }); }, [hash, message.mid, mid]); - let onReply = (json) => { - const msg = JSON.parse(json.data); - if (msg.mid == message.mid) { - setReplies(oldReplies => { - return [...oldReplies, msg]; - }); - } - }; let postComment = (template) => { const { body, attach } = template; @@ -85,6 +77,14 @@ export default function Thread(props) { loadReplies(); }, [loadReplies]); useEffect(() => { + let onReply = (json) => { + const msg = JSON.parse(json.data); + if (msg.mid == message.mid) { + setReplies(oldReplies => { + return [...oldReplies, msg]; + }); + } + }; if (props.connection.addEventListener && message.mid) { props.connection.addEventListener('msg', onReply); } @@ -93,7 +93,7 @@ export default function Thread(props) { props.connection.removeEventListener('msg', onReply); } }; - }, [props.connection, message.mid, onReply]); + }, [props.connection, message.mid]); const loaders = Math.min(message.replies || 0, 10); const pageTitle = `${params.user} ${message && message.tags || 'thread'}`; -- cgit v1.2.3