Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Only fallback to Discover if Following is first pinned (#4146)

authored by

dan and committed by
GitHub
b89e4ded d6625c29

+14 -15
+14 -15
src/state/queries/post-feed.ts
··· 17 17 import {HomeFeedAPI} from '#/lib/api/feed/home' 18 18 import {aggregateUserInterests} from '#/lib/api/feed/utils' 19 19 import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped' 20 - import {useGate} from '#/lib/statsig/statsig' 21 20 import {logger} from '#/logger' 22 21 import {STALE} from '#/state/queries' 23 22 import {DEFAULT_LOGGED_OUT_PREFERENCES} from '#/state/queries/preferences/const' ··· 111 110 const enabled = 112 111 opts?.enabled !== false && Boolean(moderationOpts) && Boolean(preferences) 113 112 const userInterests = aggregateUserInterests(preferences) 113 + const followingPinnedIndex = 114 + preferences?.savedFeeds?.findIndex( 115 + f => f.pinned && f.value === 'following', 116 + ) ?? -1 117 + const enableFollowingToDiscoverFallback = followingPinnedIndex === 0 114 118 const {getAgent} = useAgent() 115 119 const lastRun = useRef<{ 116 120 data: InfiniteData<FeedPageUnselected> ··· 118 122 result: InfiniteData<FeedPage> 119 123 } | null>(null) 120 124 const lastPageCountRef = useRef(0) 121 - const gate = useGate() 122 125 123 126 // Make sure this doesn't invalidate unless really needed. 124 127 const selectArgs = React.useMemo( ··· 150 153 feedDesc, 151 154 feedParams: params || {}, 152 155 feedTuners, 153 - userInterests, // Not in the query key because they don't change. 154 156 getAgent, 155 - useBaseFollowingFeed: gate( 156 - 'reduced_onboarding_and_home_algo_v2', 157 - { 158 - // If you're not already in this experiment, we don't want to expose you to it now. 159 - dangerouslyDisableExposureLogging: true, 160 - }, 161 - ), 157 + // Not in the query key because they don't change: 158 + userInterests, 159 + // Not in the query key. Reacting to it switching isn't important: 160 + enableFollowingToDiscoverFallback, 162 161 }), 163 162 cursor: undefined, 164 163 } ··· 392 391 feedTuners, 393 392 userInterests, 394 393 getAgent, 395 - useBaseFollowingFeed, 394 + enableFollowingToDiscoverFallback, 396 395 }: { 397 396 feedDesc: FeedDescriptor 398 397 feedParams: FeedParams 399 398 feedTuners: FeedTunerFn[] 400 399 userInterests?: string 401 400 getAgent: () => BskyAgent 402 - useBaseFollowingFeed: boolean 401 + enableFollowingToDiscoverFallback: boolean 403 402 }) { 404 403 if (feedDesc === 'following') { 405 404 if (feedParams.mergeFeedEnabled) { ··· 410 409 userInterests, 411 410 }) 412 411 } else { 413 - if (useBaseFollowingFeed) { 412 + if (enableFollowingToDiscoverFallback) { 413 + return new HomeFeedAPI({getAgent, userInterests}) 414 + } else { 414 415 return new FollowingFeedAPI({getAgent}) 415 - } else { 416 - return new HomeFeedAPI({getAgent, userInterests}) 417 416 } 418 417 } 419 418 } else if (feedDesc.startsWith('author')) {