diff options
Diffstat (limited to 'vnext/src/ui/Thread.js')
-rw-r--r-- | vnext/src/ui/Thread.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/vnext/src/ui/Thread.js b/vnext/src/ui/Thread.js index cbd40c4c..2e07cd0e 100644 --- a/vnext/src/ui/Thread.js +++ b/vnext/src/ui/Thread.js @@ -46,17 +46,20 @@ function Comment({ msg, draft, visitor, active, setActive, onStartEditing, postC }, []); useEffect(() => { isMounted = true; - if (author.uri) { - fetchUserUri(author.uri).then(response => { - if (isMounted) { - setAuthor(response.data); - } - }); - } + setAuthor(previous => { + if (previous.uri) { + fetchUserUri(previous.uri).then(response => { + if (isMounted) { + return response.data; + } + }); + } + return previous; + }); return () => { isMounted = false; }; - }, [author.uri]); + }, []); return ( <div style={chatItemStyle(visitor, msg)}> <div className="msg-header"> |