feat(chat-window): only send init msg if ready

This commit is contained in:
ItzCrazyKns 2024-10-15 16:21:00 +05:30
parent 61c0347ef2
commit 19bf71cefc
1 changed files with 2 additions and 2 deletions

View File

@ -473,11 +473,11 @@ const ChatWindow = ({ id }: { id?: string }) => {
};
useEffect(() => {
if (isReady && initialMessage) {
if (isReady && initialMessage && ws?.readyState === 1) {
sendMessage(initialMessage);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isReady, initialMessage]);
}, [isReady, initialMessage, ws?.readyState]);
if (hasError) {
return (