aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/Chat.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/ui/Chat.js')
-rw-r--r--vnext/src/ui/Chat.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/vnext/src/ui/Chat.js b/vnext/src/ui/Chat.js
index 5ecb9c0f..cdf3de1b 100644
--- a/vnext/src/ui/Chat.js
+++ b/vnext/src/ui/Chat.js
@@ -9,10 +9,10 @@ import UserInfo from './UserInfo';
import { getChat, pm } from '../api';
import './Chat.css';
+import { useVisitor } from './VisitorContext';
/**
* @typedef {Object} ChatProps
- * @property {import('../api').SecureUser} visitor
* @property {EventSource} connection
*/
@@ -21,11 +21,12 @@ import './Chat.css';
* @param {ChatProps} props
*/
export default function Chat(props) {
+ const [visitor] = useVisitor();
const [chats, setChats] = useState([]);
const params = useParams();
let loadChat = useCallback((uname) => {
- const { hash } = props.visitor;
+ const { hash } = visitor;
setChats([]);
if (hash && uname) {
getChat(uname)
@@ -33,7 +34,7 @@ export default function Chat(props) {
setChats(response.data);
});
}
- }, [props.visitor]);
+ }, []);
let onMessage = useCallback((json) => {
const msg = JSON.parse(json.data);