fixed a little bug in useListenMessages.js hook #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I checked that if a person A is online(i.e. his socket.io id is online), and he has opened the chat with person B, then at that time if any person C sends him a message then it gets rendered in the person A and B chat conversation. Because useListenMessages.js hook listens to all the messages sent to person A's socket.io id... So to prevent this while we have a selected conversation, we should add a if statement to check if the newMessage sent to our socket.io id is sent by the person we are chatting with right now, so others message will not be rendered during your ongoing chat with a person.