diff --git a/src/client/home.jsx b/src/client/home.jsx index bd03a85..12fb018 100644 --- a/src/client/home.jsx +++ b/src/client/home.jsx @@ -11,19 +11,22 @@ export default function Home() { const dispatch = useDispatch(); const favorites = useSelector(favoriteChannelsSelector); const user = useSelector(userSelector); + let path; + if (favorites.length > 0) { + path = `/chat/r/${favorites[0]}`; + } + else if (user.id) { + path = '/chat'; + } useEffect(() => { - let path; - if (favorites.length > 0) { - path = `/chat/r/${favorites[0]}`; - } - else if (user.id) { - path = '/chat'; - } if (path) { dispatch(replace(path)); } window.document.title = 'reddichat'; }); + if (path) { + return null; + } return (