diff --git a/src/state/queries/post-feed.ts b/src/state/queries/post-feed.ts index 0d54d9ee..b9e0628f 100644 --- a/src/state/queries/post-feed.ts +++ b/src/state/queries/post-feed.ts @@ -14,8 +14,10 @@ import { useInfiniteQuery, } from '@tanstack/react-query' +import {HomeFeedAPI} from '#/lib/api/feed/home' import {aggregateUserInterests} from '#/lib/api/feed/utils' import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped' +import {useGate} from '#/lib/statsig/statsig' import {logger} from '#/logger' import {STALE} from '#/state/queries' import {DEFAULT_LOGGED_OUT_PREFERENCES} from '#/state/queries/preferences/const' @@ -116,6 +118,7 @@ export function usePostFeedQuery( result: InfiniteData } | null>(null) const lastPageCountRef = useRef(0) + const gate = useGate() // Make sure this doesn't invalidate unless really needed. const selectArgs = React.useMemo( @@ -149,6 +152,7 @@ export function usePostFeedQuery( feedTuners, userInterests, // Not in the query key because they don't change. getAgent, + useBaseFollowingFeed: gate('reduced_onboarding_and_home_algo'), }), cursor: undefined, } @@ -382,12 +386,14 @@ function createApi({ feedTuners, userInterests, getAgent, + useBaseFollowingFeed, }: { feedDesc: FeedDescriptor feedParams: FeedParams feedTuners: FeedTunerFn[] userInterests?: string getAgent: () => BskyAgent + useBaseFollowingFeed: boolean }) { if (feedDesc === 'following') { if (feedParams.mergeFeedEnabled) { @@ -398,7 +404,11 @@ function createApi({ userInterests, }) } else { - return new FollowingFeedAPI({getAgent}) + if (useBaseFollowingFeed) { + return new FollowingFeedAPI({getAgent}) + } else { + return new HomeFeedAPI({getAgent, userInterests}) + } } } else if (feedDesc.startsWith('author')) { const [_, actor, filter] = feedDesc.split('|')