aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/ui')
-rw-r--r--vnext/src/ui/Chat.js2
-rw-r--r--vnext/src/ui/Thread.js18
2 files changed, 10 insertions, 10 deletions
diff --git a/vnext/src/ui/Chat.js b/vnext/src/ui/Chat.js
index f7113aaa8..2a3e90de2 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 979ef72b1..cfb67bb1d 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'}`;