From b2c6b09f065d15beee3673d5bf2c5f2aeab3e90a Mon Sep 17 00:00:00 2001 From: cha0s Date: Mon, 27 Jul 2020 22:19:41 -0500 Subject: [PATCH] fix: fouc --- src/client/home.jsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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 (