Merge commit 'f7c19226cff625895478b80302201c98f36163c8' into glitch-soc/merge-upstream

This commit is contained in:
Claire committed 2025-06-04 11:01:40 +02:00
commit 5d9e5967aa
4 files changed
+264 -6

No files matched your search

@@ -1,6 +1,7 @@
import { useEffect } from 'react';
import { fetchAccountsFamiliarFollowers } from '@/mastodon/actions/accounts_familiar_followers';
import { useIdentity } from '@/mastodon/identity_context';
import { getAccountFamiliarFollowers } from '@/mastodon/selectors/accounts';
import { useAppDispatch, useAppSelector } from '@/mastodon/store';
import { me } from 'mastodon/initial_state';
@@ -14,14 +15,15 @@ export const useFetchFamiliarFollowers = ({
const familiarFollowers = useAppSelector((state) =>
accountId ? getAccountFamiliarFollowers(state, accountId) : null,
);
const { signedIn } = useIdentity();
const hasNoData = familiarFollowers === null;
useEffect(() => {
if (hasNoData && accountId && accountId !== me) {
if (hasNoData && signedIn && accountId && accountId !== me) {
void dispatch(fetchAccountsFamiliarFollowers({ id: accountId }));
}
}, [dispatch, accountId, hasNoData]);
}, [dispatch, accountId, hasNoData, signedIn]);
return {
familiarFollowers: hasNoData ? [] : familiarFollowers,