about summary refs log tree commit diff
path: root/src/state/queries/post-thread.ts
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-04-04 17:15:40 +0300
committerGitHub <noreply@github.com>2025-04-04 07:15:40 -0700
commita0c644acfee6e80f610041cc872f89a5fcdc22b1 (patch)
tree2a587afa1cae1757610dcd39f955803566ef597e /src/state/queries/post-thread.ts
parenta15658cb66ba9d24903994512c4eb4277647d721 (diff)
downloadvoidsky-a0c644acfee6e80f610041cc872f89a5fcdc22b1.tar.zst
[Explore] Add shadow cache (#8119)
* enable shadowcache for feed previews

* extract keyextractor

* dedupe feeds
Diffstat (limited to 'src/state/queries/post-thread.ts')
-rw-r--r--src/state/queries/post-thread.ts30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/state/queries/post-thread.ts b/src/state/queries/post-thread.ts
index c162c7267..551fedc8b 100644
--- a/src/state/queries/post-thread.ts
+++ b/src/state/queries/post-thread.ts
@@ -1,18 +1,22 @@
 import {
-  AppBskyActorDefs,
-  AppBskyEmbedRecord,
+  type AppBskyActorDefs,
+  type AppBskyEmbedRecord,
   AppBskyFeedDefs,
-  AppBskyFeedGetPostThread,
+  type AppBskyFeedGetPostThread,
   AppBskyFeedPost,
   AtUri,
   moderatePost,
-  ModerationDecision,
-  ModerationOpts,
+  type ModerationDecision,
+  type ModerationOpts,
 } from '@atproto/api'
-import {QueryClient, useQuery, useQueryClient} from '@tanstack/react-query'
+import {type QueryClient, useQuery, useQueryClient} from '@tanstack/react-query'
 
+import {
+  findAllPostsInQueryData as findAllPostsInExploreFeedPreviewsQueryData,
+  findAllProfilesInQueryData as findAllProfilesInExploreFeedPreviewsQueryData,
+} from '#/state/queries/explore-feed-previews'
 import {findAllPostsInQueryData as findAllPostsInQuoteQueryData} from '#/state/queries/post-quotes'
-import {UsePreferencesQueryResponse} from '#/state/queries/preferences/types'
+import {type UsePreferencesQueryResponse} from '#/state/queries/preferences/types'
 import {
   findAllPostsInQueryData as findAllPostsInSearchQueryData,
   findAllProfilesInQueryData as findAllProfilesInSearchQueryData,
@@ -495,6 +499,12 @@ export function* findAllPostsInQueryData(
   for (let post of findAllPostsInSearchQueryData(queryClient, uri)) {
     yield postViewToPlaceholderThread(post)
   }
+  for (let post of findAllPostsInExploreFeedPreviewsQueryData(
+    queryClient,
+    uri,
+  )) {
+    yield postViewToPlaceholderThread(post)
+  }
 }
 
 export function* findAllProfilesInQueryData(
@@ -529,6 +539,12 @@ export function* findAllProfilesInQueryData(
   for (let profile of findAllProfilesInSearchQueryData(queryClient, did)) {
     yield profile
   }
+  for (let profile of findAllProfilesInExploreFeedPreviewsQueryData(
+    queryClient,
+    did,
+  )) {
+    yield profile
+  }
 }
 
 function* traverseThread(node: ThreadNode): Generator<ThreadNode, void> {