Prefer full posts for post thread placeholder (#2943)

* Revert "Prefer post over quote when finding cached post (#2935)"

This reverts commit da62a77f05.

* Prefer full posts for post thread placeholder

* Clarify with a comment
This commit is contained in:
dan 2024-02-20 19:41:29 +00:00 committed by GitHub
parent fab6c286f4
commit 3a75855677
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 67 deletions

View file

@ -365,23 +365,6 @@ function createApi(
}
}
/**
* This helper is used by the post-thread placeholder function to
* find a post in the query-data cache
*/
export function findPostInQueryData(
queryClient: QueryClient,
uri: string,
): AppBskyFeedDefs.PostView | undefined {
const generator = findAllPostsInQueryData(queryClient, uri)
const result = generator.next()
if (result.done) {
return undefined
} else {
return result.value
}
}
export function* findAllPostsInQueryData(
queryClient: QueryClient,
uri: string,
@ -391,9 +374,6 @@ export function* findAllPostsInQueryData(
>({
queryKey: ['post-feed'],
})
let foundEmbed: AppBskyFeedDefs.PostView | undefined
for (const [_queryKey, queryData] of queryDatas) {
if (!queryData?.pages) {
continue
@ -405,7 +385,7 @@ export function* findAllPostsInQueryData(
}
const quotedPost = getEmbeddedPost(item.post.embed)
if (quotedPost?.uri === uri) {
foundEmbed = embedViewRecordToPostView(quotedPost)
yield embedViewRecordToPostView(quotedPost)
}
if (
AppBskyFeedDefs.isPostView(item.reply?.parent) &&
@ -422,10 +402,6 @@ export function* findAllPostsInQueryData(
}
}
}
if (foundEmbed) {
yield foundEmbed
}
}
function assertSomePostsPassModeration(feed: AppBskyFeedDefs.FeedViewPost[]) {