Handle edge case

This commit is contained in:
Eric Bailey
2024-04-16 21:05:59 -05:00
parent 620f958f72
commit 16cc338c86
2 changed files with 10 additions and 2 deletions
+1
View File
@@ -320,6 +320,7 @@ export function usePinnedFeedsInfos() {
if (isHomeAlgoExperimentEnabled && hasSession && preferences?.homeAlgo) {
const {enabled, uri} = preferences.homeAlgo
// ONLY add the home algo if we have a URI set
if (enabled && uri) {
result = [HOME_ALGO_FEED_STUB, HOME_FEED_STUB]
}
+9 -2
View File
@@ -2,10 +2,11 @@ import React from 'react'
import {ActivityIndicator, AppState, StyleSheet, View} from 'react-native'
import {useFocusEffect} from '@react-navigation/native'
import {PROD_DEFAULT_FEED} from '#/lib/constants'
import {DISCOVER_FEED_URI, PROD_DEFAULT_FEED} from '#/lib/constants'
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
import {useSetTitle} from '#/lib/hooks/useSetTitle'
import {logEvent, LogEvents, useGate} from '#/lib/statsig/statsig'
import {logger} from '#/logger'
import {emitSoftReset} from '#/state/events'
import {FeedSourceInfo, usePinnedFeedsInfos} from '#/state/queries/feed'
import {FeedDescriptor, FeedParams} from '#/state/queries/post-feed'
@@ -65,13 +66,19 @@ function HomeScreenReady({
} else if (uri.includes('app.bsky.graph.list')) {
feeds.push(`list|${uri}`)
} else if (uri === 'home-algo') {
// TODO can I ever end up here without a feed?
if (
isHomeAlgoExperimentEnabled &&
preferences.homeAlgo.enabled &&
preferences.homeAlgo.uri
) {
feeds.push(`feedgen|${preferences.homeAlgo.uri}`)
} else {
// should never happen - esb
logger.error(`home-algo feed expected, but no URI found`, {
isHomeAlgoExperimentEnabled,
homeAlgo: preferences.homeAlgo,
})
feeds.push(`feedgen|${DISCOVER_FEED_URI}`)
}
} else if (uri === 'home') {
feeds.push('home')