diff options
-rw-r--r-- | src/lib/api/feed-manip.ts | 2 | ||||
-rw-r--r-- | src/screens/VideoFeed/index.tsx | 11 | ||||
-rw-r--r-- | src/state/queries/post-feed.ts | 2 | ||||
-rw-r--r-- | src/view/com/posts/PostFeed.tsx | 4 |
4 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/api/feed-manip.ts b/src/lib/api/feed-manip.ts index 0eca8b165..4aa20fd12 100644 --- a/src/lib/api/feed-manip.ts +++ b/src/lib/api/feed-manip.ts @@ -41,6 +41,7 @@ export class FeedViewPostsSlice { isFallbackMarker: boolean isOrphan: boolean rootUri: string + feedPostUri: string constructor(feedPost: FeedViewPost) { const {post, reply, reason} = feedPost @@ -48,6 +49,7 @@ export class FeedViewPostsSlice { this.isIncompleteThread = false this.isFallbackMarker = false this.isOrphan = false + this.feedPostUri = post.uri if (AppBskyFeedDefs.isPostView(reply?.root)) { this.rootUri = reply.root.uri } else { diff --git a/src/screens/VideoFeed/index.tsx b/src/screens/VideoFeed/index.tsx index b8403b737..3f89ed927 100644 --- a/src/screens/VideoFeed/index.tsx +++ b/src/screens/VideoFeed/index.tsx @@ -206,11 +206,14 @@ function Feed() { feedContext: string | undefined }[] = [] for (const slice of page.slices) { - for (const i of slice.items) { + const feedPost = slice.items.find( + item => item.uri === slice.feedPostUri, + ) + if (feedPost) { items.push({ - _reactKey: i._reactKey, - moderation: i.moderation, - post: i.post, + _reactKey: feedPost._reactKey, + moderation: feedPost.moderation, + post: feedPost.post, feedContext: slice.feedContext, }) } diff --git a/src/state/queries/post-feed.ts b/src/state/queries/post-feed.ts index 6f9af18f0..72d6861d6 100644 --- a/src/state/queries/post-feed.ts +++ b/src/state/queries/post-feed.ts @@ -89,6 +89,7 @@ export interface FeedPostSlice { isIncompleteThread: boolean isFallbackMarker: boolean feedContext: string | undefined + feedPostUri: string reason?: | AppBskyFeedDefs.ReasonRepost | AppBskyFeedDefs.ReasonPin @@ -330,6 +331,7 @@ export function usePostFeedQuery( isFallbackMarker: slice.isFallbackMarker, feedContext: slice.feedContext, reason: slice.reason, + feedPostUri: slice.feedPostUri, items: slice.items.map((item, i) => { const feedPostSliceItem: FeedPostSliceItem = { _reactKey: `${slice._reactKey}-${i}-${item.post.uri}`, diff --git a/src/view/com/posts/PostFeed.tsx b/src/view/com/posts/PostFeed.tsx index 4bd971b3f..67ecfa25a 100644 --- a/src/view/com/posts/PostFeed.tsx +++ b/src/view/com/posts/PostFeed.tsx @@ -347,7 +347,9 @@ let PostFeed = ({ }[] = [] for (const page of data.pages) { for (const slice of page.slices) { - const item = slice.items.at(0) + const item = slice.items.find( + item => item.uri === slice.feedPostUri, + ) if (item && AppBskyEmbedVideo.isView(item.post.embed)) { videos.push({item, feedContext: slice.feedContext}) } |