about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-02-19 16:15:42 -0800
committerGitHub <noreply@github.com>2024-02-19 16:15:42 -0800
commitda62a77f05258ce2b0609248cb5677c2406a4e63 (patch)
tree3b9ba78ac4dbc71299a2f789cf01f6133ab7ec0f /src
parent2e132a7a01333498d302b0b42f83a699b17c7840 (diff)
downloadvoidsky-da62a77f05258ce2b0609248cb5677c2406a4e63.tar.zst
Prefer post over quote when finding cached post (#2935)
Diffstat (limited to 'src')
-rw-r--r--src/state/queries/post-feed.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/state/queries/post-feed.ts b/src/state/queries/post-feed.ts
index 320009089..5035065a0 100644
--- a/src/state/queries/post-feed.ts
+++ b/src/state/queries/post-feed.ts
@@ -391,6 +391,9 @@ export function* findAllPostsInQueryData(
   >({
     queryKey: ['post-feed'],
   })
+
+  let foundEmbed: AppBskyFeedDefs.PostView | undefined
+
   for (const [_queryKey, queryData] of queryDatas) {
     if (!queryData?.pages) {
       continue
@@ -402,7 +405,7 @@ export function* findAllPostsInQueryData(
         }
         const quotedPost = getEmbeddedPost(item.post.embed)
         if (quotedPost?.uri === uri) {
-          yield embedViewRecordToPostView(quotedPost)
+          foundEmbed = embedViewRecordToPostView(quotedPost)
         }
         if (
           AppBskyFeedDefs.isPostView(item.reply?.parent) &&
@@ -419,6 +422,10 @@ export function* findAllPostsInQueryData(
       }
     }
   }
+
+  if (foundEmbed) {
+    yield foundEmbed
+  }
 }
 
 function assertSomePostsPassModeration(feed: AppBskyFeedDefs.FeedViewPost[]) {