aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/Thread.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/ui/Thread.js')
-rw-r--r--vnext/src/ui/Thread.js30
1 files changed, 14 insertions, 16 deletions
diff --git a/vnext/src/ui/Thread.js b/vnext/src/ui/Thread.js
index ec8a1eda..9d22200c 100644
--- a/vnext/src/ui/Thread.js
+++ b/vnext/src/ui/Thread.js
@@ -45,22 +45,20 @@ function Comment({ msg, draft, visitor, active, setActive, onStartEditing, postC
}
}
}, []);
- useEffect(() => {
- isMounted = true;
- setAuthor(previous => {
- if (previous.uri) {
- fetchUserUri(previous.uri).then(response => {
- if (isMounted) {
- return response.data;
- }
- });
- }
- return previous;
- });
- return () => {
- isMounted = false;
- };
- }, []);
+ const userRef = useRef(author);
+ useEffect(() => {
+ isMounted = true;
+ if (userRef.current.uri) {
+ fetchUserUri(userRef.current.uri).then(response => {
+ if (isMounted) {
+ setAuthor(response.data);
+ }
+ });
+ }
+ return () => {
+ isMounted = false;
+ };
+ }, [msg.user]);
return (
<div style={chatItemStyle(visitor, msg)}>
<div className="msg-header">