From 8603a35aea23f10e11ceb0f8c53759f3d54a2dd4 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 3 Apr 2025 12:17:39 -0500 Subject: [PATCH] Remove 'All' category and default to top interest --- src/screens/Search/Explore.tsx | 36 +++++-------------- .../modules/ExploreSuggestedAccounts.tsx | 13 ++++--- 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/src/screens/Search/Explore.tsx b/src/screens/Search/Explore.tsx index 86877677a6..a8af060b7b 100644 --- a/src/screens/Search/Explore.tsx +++ b/src/screens/Search/Explore.tsx @@ -17,7 +17,6 @@ import {useModerationOpts} from '#/state/preferences/moderation-opts' import {useActorSearchPaginated} from '#/state/queries/actor-search' import {useGetPopularFeedsQuery} from '#/state/queries/feed' import {usePreferencesQuery} from '#/state/queries/preferences' -import {useSuggestedFollowsQuery} from '#/state/queries/suggested-follows' import {useGetSuggestedFeedsQuery} from '#/state/queries/trending/useGetSuggestedFeedsQuery' import {useSuggestedStarterPacksQuery} from '#/state/queries/useSuggestedStarterPacksQuery' import {useProgressGuide} from '#/state/shell/progress-guide' @@ -195,14 +194,6 @@ export function Explore({ const gate = useGate() const guide = useProgressGuide('follow-10') const [selectedInterest, setSelectedInterest] = useState(null) - const { - data: suggestedProfiles, - hasNextPage: hasNextSuggestedProfilesPage, - isLoading: isLoadingSuggestedProfiles, - isFetchingNextPage: isFetchingNextSuggestedProfilesPage, - error: suggestedProfilesError, - fetchNextPage: fetchNextSuggestedProfilesPage, - } = useSuggestedFollowsQuery({limit: 3, subsequentPageLimit: 10}) const { data: interestProfiles, hasNextPage: hasNextInterestProfilesPage, @@ -213,7 +204,7 @@ export function Explore({ } = useActorSearchPaginated({ query: selectedInterest || '', enabled: !!selectedInterest, - limit: 10, + limit: 8, }) const {isReady: canShowSuggestedProfiles} = useLoadEnoughProfiles({ interest: selectedInterest, @@ -232,23 +223,12 @@ export function Explore({ fetchNextPage: fetchNextFeedsPage, } = useGetPopularFeedsQuery({limit: 10}) - const profiles: typeof suggestedProfiles & typeof interestProfiles = - !selectedInterest ? suggestedProfiles : interestProfiles - const hasNextProfilesPage = !selectedInterest - ? hasNextSuggestedProfilesPage - : hasNextInterestProfilesPage - const isLoadingProfiles = !selectedInterest - ? isLoadingSuggestedProfiles - : !canShowSuggestedProfiles - const isFetchingNextProfilesPage = !selectedInterest - ? isFetchingNextSuggestedProfilesPage - : !canShowSuggestedProfiles - const profilesError = !selectedInterest - ? suggestedProfilesError - : interestProfilesError - const fetchNextProfilesPage = !selectedInterest - ? fetchNextSuggestedProfilesPage - : fetchNextInterestProfilesPage + const profiles: typeof interestProfiles = interestProfiles + const hasNextProfilesPage = hasNextInterestProfilesPage + const isLoadingProfiles = !canShowSuggestedProfiles + const isFetchingNextProfilesPage = !canShowSuggestedProfiles + const profilesError = interestProfilesError + const fetchNextProfilesPage = fetchNextInterestProfilesPage const isLoadingMoreProfiles = isFetchingNextProfilesPage && !isLoadingProfiles const onLoadMoreProfiles = useCallback(async () => { @@ -709,7 +689,7 @@ export function Explore({ case 'profilePlaceholder': { return ( <> - {Array.from({length: 3}).map((_, index) => ( + {Array.from({length: 6}).map((_, index) => ( void }) { - const {_} = useLingui() const interestsDisplayNames = useInterestsDisplayNames() const {data: preferences} = usePreferencesQuery() const personalizedInterests = preferences?.interests?.tags const interests = Object.keys(interestsDisplayNames) .sort(boostInterests(popularInterests)) .sort(boostInterests(personalizedInterests)) + useEffect(() => { + if (preferences && !selectedInterest) { + onSelectInterest(interests[0]) + } + }, [selectedInterest, preferences, interests, onSelectInterest]) return ( { logger.metric( 'explore:suggestedAccounts:tabPressed', {tab: tab}, {statsig: true}, ) - onSelectInterest(tab === 'all' ? null : tab) + onSelectInterest(tab) }} hasSearchText={false} interestsDisplayNames={{ - all: _(msg`All`), ...interestsDisplayNames, }} TabComponent={Tab}