Use actual typecast, better name for feedUri

This commit is contained in:
Eric Bailey
2025-01-21 17:03:57 -06:00
parent c41e68b149
commit b640760df1
+10 -9
View File
@@ -25,6 +25,7 @@ import {useFeedFeedbackContext} from '#/state/feed-feedback'
import {useTrendingSettings} from '#/state/preferences/trending' import {useTrendingSettings} from '#/state/preferences/trending'
import {STALE} from '#/state/queries' import {STALE} from '#/state/queries'
import { import {
AuthorFilter,
FeedDescriptor, FeedDescriptor,
FeedParams, FeedParams,
FeedPostSlice, FeedPostSlice,
@@ -195,7 +196,7 @@ let PostFeed = ({
const [isPTRing, setIsPTRing] = React.useState(false) const [isPTRing, setIsPTRing] = React.useState(false)
const checkForNewRef = React.useRef<(() => void) | null>(null) const checkForNewRef = React.useRef<(() => void) | null>(null)
const lastFetchRef = React.useRef<number>(Date.now()) const lastFetchRef = React.useRef<number>(Date.now())
const [feedType, feedUri, feedTab] = feed.split('|') const [feedType, feedUriOrActorDid, feedTab] = feed.split('|')
const {gtMobile, gtTablet} = useBreakpoints() const {gtMobile, gtTablet} = useBreakpoints()
const areVideoFeedsEnabled = isNative const areVideoFeedsEnabled = isNative
@@ -308,7 +309,7 @@ let PostFeed = ({
let feedKind: 'following' | 'discover' | 'profile' | 'thevids' | undefined let feedKind: 'following' | 'discover' | 'profile' | 'thevids' | undefined
if (feedType === 'following') { if (feedType === 'following') {
feedKind = 'following' feedKind = 'following'
} else if (feedUri === DISCOVER_FEED_URI) { } else if (feedUriOrActorDid === DISCOVER_FEED_URI) {
feedKind = 'discover' feedKind = 'discover'
} else if ( } else if (
feedType === 'author' && feedType === 'author' &&
@@ -319,7 +320,7 @@ let PostFeed = ({
} }
let arr: FeedRow[] = [] let arr: FeedRow[] = []
if (KNOWN_SHUTDOWN_FEEDS.includes(feedUri)) { if (KNOWN_SHUTDOWN_FEEDS.includes(feedUriOrActorDid)) {
arr.push({ arr.push({
type: 'feedShutdownMsg', type: 'feedShutdownMsg',
key: 'feedShutdownMsg', key: 'feedShutdownMsg',
@@ -377,7 +378,7 @@ let PostFeed = ({
type: 'videoGridRow', type: 'videoGridRow',
key: row.map(r => r.item._reactKey).join('-'), key: row.map(r => r.item._reactKey).join('-'),
items: row.map(r => r.item), items: row.map(r => r.item),
sourceFeedUri: feedUri, sourceFeedUri: feedUriOrActorDid,
feedContexts: row.map(r => r.feedContext), feedContexts: row.map(r => r.feedContext),
}) })
} }
@@ -505,7 +506,7 @@ let PostFeed = ({
lastFetchedAt, lastFetchedAt,
data, data,
feedType, feedType,
feedUri, feedUriOrActorDid,
feedTab, feedTab,
hasSession, hasSession,
showProgressIntersitial, showProgressIntersitial,
@@ -596,7 +597,7 @@ let PostFeed = ({
} else if (row.type === 'loading') { } else if (row.type === 'loading') {
return <PostFeedLoadingPlaceholder /> return <PostFeedLoadingPlaceholder />
} else if (row.type === 'feedShutdownMsg') { } else if (row.type === 'feedShutdownMsg') {
return <FeedShutdownMsg feedUri={feedUri} /> return <FeedShutdownMsg feedUri={feedUriOrActorDid} />
} else if (row.type === 'interstitialFollows') { } else if (row.type === 'interstitialFollows') {
return <SuggestedFollows feed={feed} /> return <SuggestedFollows feed={feed} />
} else if (row.type === 'interstitialProgressGuide') { } else if (row.type === 'interstitialProgressGuide') {
@@ -656,8 +657,8 @@ let PostFeed = ({
if (feedType === 'author') { if (feedType === 'author') {
sourceContext = { sourceContext = {
type: 'author', type: 'author',
did: feedUri, did: feedUriOrActorDid,
filter: feedTab as any, filter: feedTab as AuthorFilter,
sourceInterstitial: 'none', sourceInterstitial: 'none',
} }
} }
@@ -681,7 +682,7 @@ let PostFeed = ({
_, _,
onPressRetryLoadMore, onPressRetryLoadMore,
feedType, feedType,
feedUri, feedUriOrActorDid,
feedTab, feedTab,
feedCacheKey, feedCacheKey,
], ],