Make types legit

This commit is contained in:
Eric Bailey
2025-01-16 17:36:59 -06:00
parent a1773a6911
commit e37256a30a
6 changed files with 41 additions and 14 deletions
+12 -2
View File
@@ -111,6 +111,16 @@ export function VibeScreen({}: Props) {
function YoloFeed() {
const {params} = useRoute<RouteProp<CommonNavigatorParams, 'VideoFeed'>>()
const isFocused = useIsFocused()
const feedDesc = useMemo(() => {
switch (params.type) {
case 'feedgen':
return `feedgen|${params.uri}` as const
case 'author':
return `author|${params.did}|${params.filter}` as const
default:
throw new Error(`Invalid video feed params ${JSON.stringify(params)}`)
}
}, [params])
const {
data,
isFetching,
@@ -118,13 +128,13 @@ function YoloFeed() {
hasNextPage,
isFetchingNextPage,
fetchNextPage,
} = usePostFeedQuery(`feedgen|${params.feedUri}`)
} = usePostFeedQuery(feedDesc)
let videos = data?.pages.flatMap(page =>
page.slices.flatMap(slice => slice.items),
)
const startingVideoIndex = videos?.findIndex(video => {
return video.post.uri === params.postUri
return video.post.uri === params.initialPostUri
})
if (videos && startingVideoIndex && startingVideoIndex > -1) {
videos = videos.slice(startingVideoIndex)