Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Use same source for pinned feeds on Home and tab/sidebars (#2235)

authored by

Eric Bailey and committed by
GitHub
14c77255 8df4fd4d

+10 -4
+1
src/state/queries/feed.ts
··· 249 249 // these requests can fail, need to filter those out 250 250 try { 251 251 return await queryClient.fetchQuery({ 252 + staleTime: STALE.SECONDS.FIFTEEN, 252 253 queryKey: feedSourceInfoQueryKey({uri}), 253 254 queryFn: async () => { 254 255 const type = getFeedTypeFromUri(uri)
+9 -4
src/view/screens/Home.tsx
··· 12 12 import {HomeLoggedOutCTA} from '../com/auth/HomeLoggedOutCTA' 13 13 import {useSetMinimalShellMode, useSetDrawerSwipeDisabled} from '#/state/shell' 14 14 import {usePreferencesQuery} from '#/state/queries/preferences' 15 + import {usePinnedFeedsInfos, FeedSourceInfo} from '#/state/queries/feed' 15 16 import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types' 16 17 import {emitSoftReset} from '#/state/events' 17 18 import {useSession} from '#/state/session' ··· 21 22 type Props = NativeStackScreenProps<HomeTabNavigatorParams, 'Home'> 22 23 export function HomeScreen(props: Props) { 23 24 const {data: preferences} = usePreferencesQuery() 25 + const {feeds: pinnedFeeds} = usePinnedFeedsInfos() 24 26 const {isDesktop} = useWebMediaQueries() 25 27 const [initialPage, setInitialPage] = React.useState<string | undefined>( 26 28 undefined, ··· 39 41 loadLastActivePage() 40 42 }, []) 41 43 42 - if (preferences && initialPage !== undefined) { 44 + if (preferences && pinnedFeeds && initialPage !== undefined) { 43 45 return ( 44 46 <HomeScreenReady 45 47 {...props} 46 48 preferences={preferences} 49 + pinnedFeeds={pinnedFeeds} 47 50 initialPage={isDesktop ? 'Following' : initialPage} 48 51 /> 49 52 ) ··· 58 61 59 62 function HomeScreenReady({ 60 63 preferences, 64 + pinnedFeeds, 61 65 initialPage, 62 66 }: Props & { 63 67 preferences: UsePreferencesQueryResponse 68 + pinnedFeeds: FeedSourceInfo[] 64 69 initialPage: string 65 70 }) { 66 71 const {hasSession} = useSession() ··· 82 87 }, [preferences.feeds.pinned, selectedPage]) 83 88 84 89 const customFeeds = React.useMemo(() => { 85 - const pinned = preferences.feeds.pinned 90 + const pinned = pinnedFeeds 86 91 const feeds: FeedDescriptor[] = [] 87 - for (const uri of pinned) { 92 + for (const {uri} of pinned) { 88 93 if (uri.includes('app.bsky.feed.generator')) { 89 94 feeds.push(`feedgen|${uri}`) 90 95 } else if (uri.includes('app.bsky.graph.list')) { ··· 92 97 } 93 98 } 94 99 return feeds 95 - }, [preferences.feeds.pinned]) 100 + }, [pinnedFeeds]) 96 101 97 102 const homeFeedParams = React.useMemo<FeedParams>(() => { 98 103 return {