From e54d666b90196ce037f903b3863ca525feb023cc Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 6 Jun 2022 13:43:38 -0500 Subject: [PATCH] HomeTimeline: move useEffect above return --- app/soapbox/features/home_timeline/index.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/soapbox/features/home_timeline/index.tsx b/app/soapbox/features/home_timeline/index.tsx index 79cca2b9d0..99ed0d5696 100644 --- a/app/soapbox/features/home_timeline/index.tsx +++ b/app/soapbox/features/home_timeline/index.tsx @@ -23,14 +23,6 @@ const HomeTimeline: React.FC = () => { dispatch(expandHomeTimeline({ maxId })); }; - useEffect(() => { - checkIfReloadNeeded(); - - return () => { - stopPolling(); - }; - }, [isPartial]); - // Mastodon generates the feed in Redis, and can return a partial timeline // (HTTP 206) for new users. Poll until we get a full page of results. const checkIfReloadNeeded = () => { @@ -54,6 +46,14 @@ const HomeTimeline: React.FC = () => { return dispatch(expandHomeTimeline()); }; + useEffect(() => { + checkIfReloadNeeded(); + + return () => { + stopPolling(); + }; + }, [isPartial]); + return (