From 74d2325b582cba218f7ccaea527a816286bf108e Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 12 Sep 2022 10:14:57 -0500 Subject: [PATCH] Favourites: unavailable --> isUnavailable, move useEffect's down --- .../features/favourited_statuses/index.tsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/soapbox/features/favourited_statuses/index.tsx b/app/soapbox/features/favourited_statuses/index.tsx index 2b720ab4c0..1a8ba3bfa1 100644 --- a/app/soapbox/features/favourited_statuses/index.tsx +++ b/app/soapbox/features/favourited_statuses/index.tsx @@ -38,11 +38,19 @@ const Favourites: React.FC = (props) => { const isLoading = useAppSelector(state => state.status_lists.get(timelineKey)?.isLoading === true); 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; 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(() => { if (isOwnAccount) dispatch(fetchFavouritedStatuses()); @@ -63,15 +71,7 @@ const Favourites: React.FC = (props) => { } }, [account?.id]); - const handleLoadMore = useCallback(debounce(() => { - if (isOwnAccount) { - dispatch(expandFavouritedStatuses()); - } else if (account) { - dispatch(expandAccountFavouritedStatuses(account.id)); - } - }, 300, { leading: true }), [account?.id]); - - if (unavailable) { + if (isUnavailable) { return (