sforkowany z mirror/soapbox
HomeTimeline: move useEffect above return
rodzic
54b6df719c
commit
e54d666b90
|
@ -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
|
||||
|
|
Ładowanie…
Reference in New Issue