feat(chat-window): only send init msg if ready
This commit is contained in:
parent
61c0347ef2
commit
19bf71cefc
|
@ -473,11 +473,11 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isReady && initialMessage) {
|
if (isReady && initialMessage && ws?.readyState === 1) {
|
||||||
sendMessage(initialMessage);
|
sendMessage(initialMessage);
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [isReady, initialMessage]);
|
}, [isReady, initialMessage, ws?.readyState]);
|
||||||
|
|
||||||
if (hasError) {
|
if (hasError) {
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue