fix: check every loaded page before calling a list empty
these lists only looked at the first page, so a profile whose first page of feeds, lists, or starter packs came back empty rendered the empty state even after later pages loaded.
54 unmodified lines555657585959606162636465115 unmodified linesExpand all54 unmodified linesexport function ProfileStarterPacks({ did, isMe, starterPackCount }: ProfileStarterPacksProps): ReactNode { const router = useRouter(); const { data, isPending, isFetchingNextPage, hasNextPage, fetchNextPage, isError, error, refetch } = useActorStarterPacksQuery({ did }); const isEmpty = !isPending && !data?.pages[0]?.starterPacks.length; const starterPacks = data?.pages.flatMap((page) => page.starterPacks); const hasStarterPacks = !!starterPacks?.length; const isEmpty = !isPending && !hasStarterPacks;
let items: StarterPackItem[] = []; if (isError && isEmpty) { items = items.concat([ERROR_ITEM]);115 unmodified linesExpand all22 unmodified lines232425262727282930313273 unmodified lines22 unmodified lines useTitle(m['common.block.accountsTitle']());
const { data, isFetching, isError, error, refetch, hasNextPage, fetchNextPage, isFetchingNextPage } = useMyBlockedAccountsQuery(); const isEmpty = !isFetching && !data?.pages[0]?.blocks.length; const profiles = data?.pages ? data.pages.flatMap((page) => page.blocks) : []; const isEmpty = !isFetching && profiles.length === 0;
const onEndReached = () => { if (isFetching || !hasNextPage || isError) { return;73 unmodified lines23 unmodified lines242526272828293031323384 unmodified lines23 unmodified lines useTitle(m['common.mute.accountsTitle']());
const { data, isFetching, isError, error, refetch, hasNextPage, fetchNextPage, isFetchingNextPage } = useMyMutedAccountsQuery(); const isEmpty = !isFetching && !data?.pages[0]?.mutes.length; const profiles = data?.pages ? data.pages.flatMap((page) => page.mutes) : []; const isEmpty = !isFetching && profiles.length === 0;
const onEndReached = () => { if (isFetching || !hasNextPage || isError) { return;84 unmodified lines47 unmodified lines4849505152525354555666 unmodified lines47 unmodified lines enabled: enabled && !!moderationOpts, filter, }); // check all pages because mentions can leave the first page empty. const isEmpty = !isFetching && !data?.pages.find((page) => page.items.length > 0); const isEmpty = !isFetching && !data?.pages.some((page) => page.items.length);
let items: NotificationItem[] = []; if (isFetched) { if (isEmpty) {66 unmodified lines47 unmodified lines4849505152525354555699 unmodified lines47 unmodified lines
export function ProfileFeedgens({ did, feedCount }: ProfileFeedgensProps): ReactNode { const { data, isPending, isFetchingNextPage, hasNextPage, fetchNextPage, isError, error, refetch } = useProfileFeedgensQuery(did); const isEmpty = !isPending && !data?.pages[0]?.feeds.length; const isEmpty = !isPending && !data?.pages.some((page) => page.feeds.length); const { data: preferences } = usePreferencesQuery(); const router = useRouter(); const { currentAccount } = useSession(); const isSelf = currentAccount?.did === did;99 unmodified lines47 unmodified lines4849505152525354555699 unmodified lines47 unmodified lines
export function ProfileLists({ did, listCount }: ProfileListsProps): ReactNode { const { data, isPending, isFetchingNextPage, hasNextPage, fetchNextPage, isError, error, refetch } = useProfileListsQuery(did); const isEmpty = !isPending && !data?.pages[0]?.lists.length; const isEmpty = !isPending && !data?.pages.some((page) => page.lists.length); const { data: preferences } = usePreferencesQuery(); const router = useRouter(); const { currentAccount } = useSession(); const isSelf = currentAccount?.did === did;99 unmodified lines