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.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/vnext/src/ui/Thread.js b/vnext/src/ui/Thread.js
index 5c9412d6..b2d17824 100644
--- a/vnext/src/ui/Thread.js
+++ b/vnext/src/ui/Thread.js
@@ -7,6 +7,7 @@ import MessageInput from './MessageInput';
import Spinner from './Spinner';
import { getMessages, comment, update } from '../api';
+import { useVisitor } from './VisitorContext';
/**
* @type { import('../api').Message }
*/
@@ -14,7 +15,6 @@ const emptyMessage = {};
/**
* @param {{
- visitor: import('../api').SecureUser
connection: EventSource?
}} props
*/
@@ -27,7 +27,8 @@ export default function Thread(props) {
const [active, setActive] = useState(0);
const [editing, setEditing] = useState(emptyMessage);
- const [hash] = useState(props.visitor.hash);
+ const [visitor] = useVisitor();
+ const [hash] = useState(visitor.hash);
const { mid } = params;
let loadReplies = useCallback(() => {
@@ -97,7 +98,7 @@ export default function Thread(props) {
<>
{
message.mid ? (
- <Message data={message} visitor={props.visitor}>
+ <Message data={message}>
{active === (message.rid || 0) && <MessageInput data={message} text={editing.body || ''} onSend={postComment}>Write a comment...</MessageInput>}
</Message>
) : (
@@ -109,7 +110,7 @@ export default function Thread(props) {
{
!loading ? replies.map((msg) => (
<li id={msg.rid} key={msg.rid}>
- <Comment msg={msg} draft={msg.rid === editing.replyto ? editing.body : ''} visitor={props.visitor} active={active} setActive={setActive} onStartEditing={startEditing} postComment={postComment} />
+ <Comment msg={msg} draft={msg.rid === editing.replyto ? editing.body : ''} active={active} setActive={setActive} onStartEditing={startEditing} postComment={postComment} />
</li>
)) : (
<>