HomeTimeline: move useEffect above return

This commit is contained in:
Alex Gleason 2022-06-06 13:43:38 -05:00
parent 54b6df719c
commit e54d666b90
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -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 (
<Column label={intl.formatMessage(messages.title)} transparent>
<Timeline