Randomize the feeds shown in interstitial

This commit is contained in:
Eric Bailey
2024-07-03 10:33:58 -05:00
parent a3d4fb652b
commit 6ee2e42f55
2 changed files with 9 additions and 2 deletions
+7
View File
@@ -230,8 +230,15 @@ export function SuggestedFeeds() {
const numFeedsToDisplay = 3 const numFeedsToDisplay = 3
const t = useTheme() const t = useTheme()
const {_} = useLingui() const {_} = useLingui()
const [initialCursor] = React.useState(() => {
const min = 9880
const max = 9999
const range = max - min
return Math.floor(Math.random() * range) + min + ''
})
const {data, isLoading, error} = useGetPopularFeedsQuery({ const {data, isLoading, error} = useGetPopularFeedsQuery({
limit: numFeedsToDisplay, limit: numFeedsToDisplay,
cursor: initialCursor,
}) })
const navigation = useNavigation<NavigationProp>() const navigation = useNavigation<NavigationProp>()
const {gtMobile} = useBreakpoints() const {gtMobile} = useBreakpoints()
+2 -2
View File
@@ -193,7 +193,7 @@ export const KNOWN_AUTHED_ONLY_FEEDS = [
'at://did:plc:vpkhqolt662uhesyj6nxm7ys/app.bsky.feed.generator/followpics', // the gram, by why 'at://did:plc:vpkhqolt662uhesyj6nxm7ys/app.bsky.feed.generator/followpics', // the gram, by why
] ]
type GetPopularFeedsOptions = {limit?: number} type GetPopularFeedsOptions = {limit?: number; cursor?: string}
export function createGetPopularFeedsQueryKey( export function createGetPopularFeedsQueryKey(
options?: GetPopularFeedsOptions, options?: GetPopularFeedsOptions,
@@ -240,7 +240,7 @@ export function useGetPopularFeedsQuery(options?: GetPopularFeedsOptions) {
return res.data return res.data
}, },
initialPageParam: undefined, initialPageParam: options?.cursor,
getNextPageParam: lastPage => lastPage.cursor, getNextPageParam: lastPage => lastPage.cursor,
select: useCallback( select: useCallback(
( (