diff options
author | Vitaly Takmazov | 2022-11-13 18:44:54 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-13 10:37:58 +0300 |
commit | 2fb4a2c1a32a71c41e84b2bc5c0fa3c4b3f199f9 (patch) | |
tree | f58c7d0254ec7b0251b691b300067b7a36b78f3c /vnext/src/ui | |
parent | 2934a854c7a77c8f65316ffa4d411866648c984f (diff) |
ESLint: configure additional plugins
Diffstat (limited to 'vnext/src/ui')
-rw-r--r-- | vnext/src/ui/Chat.js | 2 | ||||
-rw-r--r-- | vnext/src/ui/Thread.js | 18 |
2 files changed, 10 insertions, 10 deletions
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'}`; |