fix: fouc
This commit is contained in:
parent
7848215ac6
commit
b2c6b09f06
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue
Block a user