Skip to content

Commit

Permalink
fixxxx
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman committed Aug 17, 2024
1 parent 8607694 commit 2f0e6a0
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions frontend/src/Components/mainPage/Channels.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,11 @@ const Channels = ({ filter }) => {
};

useEffect(() => { /* eslint-disable-line */
const handleNewChannel = (payload) => {
dispatch(addChannel(payload)); /* eslint-disable-line */
if (isChannelCreator) { /* eslint-disable-line */
dispatch(setCurrentChannelId(payload.id)); /* eslint-disable-line */
setIsChannelCreator(false); /* eslint-disable-line */
}
};

socket.on('newChannel', handleNewChannel); /* eslint-disable-line */

return () => {
socket.off('newChannel', handleNewChannel); /* eslint-disable-line */
};
dispatch(addChannel(payload)); /* eslint-disable-line */
if (isChannelCreator) { /* eslint-disable-line */
dispatch(setCurrentChannelId(payload.id)); /* eslint-disable-line */
setIsChannelCreator(false); /* eslint-disable-line */
}
}, [dispatch, isChannelCreator]);

return (
Expand Down

0 comments on commit 2f0e6a0

Please sign in to comment.