Favourites: unavailable --> isUnavailable, move useEffect's down
This commit is contained in:
parent
0355d2a927
commit
74d2325b58
1 changed files with 10 additions and 10 deletions
|
@ -38,11 +38,19 @@ const Favourites: React.FC<IFavourites> = (props) => {
|
||||||
const isLoading = useAppSelector(state => state.status_lists.get(timelineKey)?.isLoading === true);
|
const isLoading = useAppSelector(state => state.status_lists.get(timelineKey)?.isLoading === true);
|
||||||
const hasMore = useAppSelector(state => !!state.status_lists.get(timelineKey)?.next);
|
const hasMore = useAppSelector(state => !!state.status_lists.get(timelineKey)?.next);
|
||||||
|
|
||||||
const unavailable = useAppSelector(state => {
|
const isUnavailable = useAppSelector(state => {
|
||||||
const blockedBy = state.relationships.getIn([account?.id, 'blocked_by']) === true;
|
const blockedBy = state.relationships.getIn([account?.id, 'blocked_by']) === true;
|
||||||
return isOwnAccount ? false : (blockedBy && !features.blockersVisible);
|
return isOwnAccount ? false : (blockedBy && !features.blockersVisible);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handleLoadMore = useCallback(debounce(() => {
|
||||||
|
if (isOwnAccount) {
|
||||||
|
dispatch(expandFavouritedStatuses());
|
||||||
|
} else if (account) {
|
||||||
|
dispatch(expandAccountFavouritedStatuses(account.id));
|
||||||
|
}
|
||||||
|
}, 300, { leading: true }), [account?.id]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOwnAccount)
|
if (isOwnAccount)
|
||||||
dispatch(fetchFavouritedStatuses());
|
dispatch(fetchFavouritedStatuses());
|
||||||
|
@ -63,15 +71,7 @@ const Favourites: React.FC<IFavourites> = (props) => {
|
||||||
}
|
}
|
||||||
}, [account?.id]);
|
}, [account?.id]);
|
||||||
|
|
||||||
const handleLoadMore = useCallback(debounce(() => {
|
if (isUnavailable) {
|
||||||
if (isOwnAccount) {
|
|
||||||
dispatch(expandFavouritedStatuses());
|
|
||||||
} else if (account) {
|
|
||||||
dispatch(expandAccountFavouritedStatuses(account.id));
|
|
||||||
}
|
|
||||||
}, 300, { leading: true }), [account?.id]);
|
|
||||||
|
|
||||||
if (unavailable) {
|
|
||||||
return (
|
return (
|
||||||
<Column>
|
<Column>
|
||||||
<div className='empty-column-indicator'>
|
<div className='empty-column-indicator'>
|
||||||
|
|
Loading…
Reference in a new issue