Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

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

Fix blank home screen (close #2281) (#2291)

authored by

Paul Frazee and committed by
GitHub
fe0a35cb 64bad57e

+14 -4
+4 -1
src/state/queries/feed.ts
··· 218 218 export function usePinnedFeedsInfos(): { 219 219 feeds: FeedSourceInfo[] 220 220 hasPinnedCustom: boolean 221 + isLoading: boolean 221 222 } { 222 223 const queryClient = useQueryClient() 223 224 const [tabs, setTabs] = React.useState<FeedSourceInfo[]>([ 224 225 FOLLOWING_FEED_STUB, 225 226 ]) 227 + const [isLoading, setLoading] = React.useState(true) 226 228 const {data: preferences} = usePreferencesQuery() 227 229 228 230 const hasPinnedCustom = React.useMemo<boolean>(() => { ··· 284 286 ) as FeedSourceInfo[] 285 287 286 288 setTabs([FOLLOWING_FEED_STUB].concat(views)) 289 + setLoading(false) 287 290 } 288 291 289 292 fetchFeedInfo() 290 293 }, [queryClient, setTabs, preferences?.feeds?.pinned]) 291 294 292 - return {feeds: tabs, hasPinnedCustom} 295 + return {feeds: tabs, hasPinnedCustom, isLoading} 293 296 }
+10 -3
src/view/screens/Home.tsx
··· 18 18 import {useSession} from '#/state/session' 19 19 import {loadString, saveString} from '#/lib/storage' 20 20 import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries' 21 + import {clamp} from '#/lib/numbers' 21 22 22 23 type Props = NativeStackScreenProps<HomeTabNavigatorParams, 'Home'> 23 24 export function HomeScreen(props: Props) { 24 25 const {data: preferences} = usePreferencesQuery() 25 - const {feeds: pinnedFeeds} = usePinnedFeedsInfos() 26 + const {feeds: pinnedFeeds, isLoading: isPinnedFeedsLoading} = 27 + usePinnedFeedsInfos() 26 28 const {isDesktop} = useWebMediaQueries() 27 29 const [initialPage, setInitialPage] = React.useState<string | undefined>( 28 30 undefined, ··· 41 43 loadLastActivePage() 42 44 }, []) 43 45 44 - if (preferences && pinnedFeeds && initialPage !== undefined) { 46 + if ( 47 + preferences && 48 + pinnedFeeds && 49 + initialPage !== undefined && 50 + !isPinnedFeedsLoading 51 + ) { 45 52 return ( 46 53 <HomeScreenReady 47 54 {...props} ··· 172 179 <Pager 173 180 key={pinnedFeedOrderKey} 174 181 testID="homeScreen" 175 - initialPage={selectedPageIndex} 182 + initialPage={clamp(selectedPageIndex, 0, customFeeds.length)} 176 183 onPageSelected={onPageSelected} 177 184 onPageScrollStateChanged={onPageScrollStateChanged} 178 185 renderTabBar={renderTabBar}