fix: fouc

This commit is contained in:
cha0s 2020-07-27 22:19:41 -05:00
parent 7848215ac6
commit b2c6b09f06

View File

@ -11,7 +11,6 @@ export default function Home() {
const dispatch = useDispatch();
const favorites = useSelector(favoriteChannelsSelector);
const user = useSelector(userSelector);
useEffect(() => {
let path;
if (favorites.length > 0) {
path = `/chat/r/${favorites[0]}`;
@ -19,11 +18,15 @@ export default function Home() {
else if (user.id) {
path = '/chat';
}
useEffect(() => {
if (path) {
dispatch(replace(path));
}
window.document.title = 'reddichat';
});
if (path) {
return null;
}
return (
<div className="home">
<div className="home__inner">