HomeTimeline: move useEffect above return
This commit is contained in:
parent
54b6df719c
commit
e54d666b90
1 changed files with 8 additions and 8 deletions
|
@ -23,14 +23,6 @@ const HomeTimeline: React.FC = () => {
|
||||||
dispatch(expandHomeTimeline({ maxId }));
|
dispatch(expandHomeTimeline({ maxId }));
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
checkIfReloadNeeded();
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
stopPolling();
|
|
||||||
};
|
|
||||||
}, [isPartial]);
|
|
||||||
|
|
||||||
// Mastodon generates the feed in Redis, and can return a partial timeline
|
// 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.
|
// (HTTP 206) for new users. Poll until we get a full page of results.
|
||||||
const checkIfReloadNeeded = () => {
|
const checkIfReloadNeeded = () => {
|
||||||
|
@ -54,6 +46,14 @@ const HomeTimeline: React.FC = () => {
|
||||||
return dispatch(expandHomeTimeline());
|
return dispatch(expandHomeTimeline());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
checkIfReloadNeeded();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
stopPolling();
|
||||||
|
};
|
||||||
|
}, [isPartial]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column label={intl.formatMessage(messages.title)} transparent>
|
<Column label={intl.formatMessage(messages.title)} transparent>
|
||||||
<Timeline
|
<Timeline
|
||||||
|
|
Loading…
Reference in a new issue