'Fix' double chat messages
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
66d70cbfe4
commit
1f5e5c944c
|
@ -12,6 +12,7 @@ function useBackendData(userInfo: UserInfo) {
|
||||||
const { addChatMessage } = useAllChat()
|
const { addChatMessage } = useAllChat()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log('[Rooms] add onMessage Listener')
|
||||||
onMessage((messageString) => {
|
onMessage((messageString) => {
|
||||||
console.log('[Rooms] message from ws', messageString)
|
console.log('[Rooms] message from ws', messageString)
|
||||||
const messageObject = JSON.parse(messageString)
|
const messageObject = JSON.parse(messageString)
|
||||||
|
@ -20,7 +21,7 @@ function useBackendData(userInfo: UserInfo) {
|
||||||
!!messageObject.content && addChatMessage(messageObject)
|
!!messageObject.content && addChatMessage(messageObject)
|
||||||
return disconnect
|
return disconnect
|
||||||
})
|
})
|
||||||
}, [onMessage, setRoomData, disconnect])
|
}, [])
|
||||||
|
|
||||||
return { roomData, sendMessage }
|
return { roomData, sendMessage }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue