Fixed message not sending when closing db

This commit is contained in:
Lucas Oliveira 2023-09-05 15:20:51 -03:00
commit b6c5fecae2

View file

@ -194,7 +194,8 @@ export default function FormModal({
} }
function handleWsMessage(data: any) { function handleWsMessage(data: any) {
if (Array.isArray(data)) { console.log(data);
if (Array.isArray(data) && data.length > 0) {
//set chat history //set chat history
setChatHistory((_) => { setChatHistory((_) => {
let newChatHistory: ChatMessageType[] = []; let newChatHistory: ChatMessageType[] = [];
@ -313,7 +314,7 @@ export default function FormModal({
} }
}; };
// do not add connectWS on dependencies array // do not add connectWS on dependencies array
}, []); }, [open]);
useEffect(() => { useEffect(() => {
if ( if (