Fix undefined logic, remove header for interstitial

This commit is contained in:
Dan Abramov
2025-01-19 20:49:43 +00:00
parent b1079471a6
commit 69c035214d
6 changed files with 12 additions and 10 deletions
@@ -174,7 +174,7 @@ function VideoCards({
sourceContext={{ sourceContext={{
type: 'feedgen', type: 'feedgen',
uri: VIDEO_FEED_URI, uri: VIDEO_FEED_URI,
feedCacheKey: 'discover', sourceInterstitial: 'discover',
}} }}
onInteract={() => { onInteract={() => {
logEvent('videoCard:click', { logEvent('videoCard:click', {
@@ -214,7 +214,7 @@ function VideoCards({
sourceContext={{ sourceContext={{
type: 'feedgen', type: 'feedgen',
uri: VIDEO_FEED_URI, uri: VIDEO_FEED_URI,
feedCacheKey: 'explore', sourceInterstitial: 'explore',
}} }}
onInteract={() => { onInteract={() => {
logEvent('videoCard:click', { logEvent('videoCard:click', {
@@ -107,6 +107,11 @@ export function FeedHeader({
return null return null
} }
if (sourceContext.sourceInterstitial !== undefined) {
// For now, don't show the header if coming from an interstitial.
return null
}
return ( return (
<View style={[a.flex_1, a.flex_row, a.align_center, a.gap_sm]}> <View style={[a.flex_1, a.flex_row, a.align_center, a.gap_sm]}>
{info.avatar && <UserAvatar size={36} type="algo" avatar={info.avatar} />} {info.avatar && <UserAvatar size={36} type="algo" avatar={info.avatar} />}
+2 -2
View File
@@ -192,9 +192,9 @@ function Feed() {
const {data, error, hasNextPage, isFetchingNextPage, fetchNextPage} = const {data, error, hasNextPage, isFetchingNextPage, fetchNextPage} =
usePostFeedQuery( usePostFeedQuery(
feedDesc, feedDesc,
params.type === 'feedgen' && params.feedCacheKey !== undefined params.type === 'feedgen' && params.sourceInterstitial !== 'none'
? { ? {
feedCacheKey: params.feedCacheKey, feedCacheKey: params.sourceInterstitial,
} }
: undefined, : undefined,
) )
+1 -1
View File
@@ -7,8 +7,8 @@ export type VideoFeedSourceContext =
| { | {
type: 'feedgen' type: 'feedgen'
uri: string uri: string
sourceInterstitial: 'discover' | 'explore' | 'none'
initialPostUri?: string initialPostUri?: string
feedCacheKey?: 'discover' | 'explore' | undefined
} }
| { | {
type: 'author' type: 'author'
+2 -5
View File
@@ -14,10 +14,7 @@ import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {useQueryClient} from '@tanstack/react-query' import {useQueryClient} from '@tanstack/react-query'
import { import {DISCOVER_FEED_URI, KNOWN_SHUTDOWN_FEEDS} from '#/lib/constants'
DISCOVER_FEED_URI,
KNOWN_SHUTDOWN_FEEDS,
} from '#/lib/constants'
import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender' import {useInitialNumToRender} from '#/lib/hooks/useInitialNumToRender'
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries' import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
import {useGate} from '#/lib/statsig/statsig' import {useGate} from '#/lib/statsig/statsig'
@@ -655,7 +652,7 @@ let PostFeed = ({
sourceContext={{ sourceContext={{
type: 'feedgen', type: 'feedgen',
uri: row.sourceFeedUri, uri: row.sourceFeedUri,
feedCacheKey: feedCacheKey, sourceInterstitial: feedCacheKey ?? 'none',
}} }}
/> />
) )