about summary refs log tree commit diff
path: root/src/view/com/post-thread/PostThread.tsx
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-08-21 22:16:03 -0500
committerGitHub <noreply@github.com>2024-08-21 20:16:03 -0700
commitd5c78b9183ac78620f59538fed61c8130ae1c47a (patch)
tree53ad7c63b9263e508df587aa6d837c4036f394e9 /src/view/com/post-thread/PostThread.tsx
parent61f0be705d614a31331945e1c4b9361d71b81403 (diff)
downloadvoidsky-d5c78b9183ac78620f59538fed61c8130ae1c47a.tar.zst
Prep threadgate shadow hack (#4970)
Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/view/com/post-thread/PostThread.tsx')
-rw-r--r--src/view/com/post-thread/PostThread.tsx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx
index bd778fd98..3757d76c6 100644
--- a/src/view/com/post-thread/PostThread.tsx
+++ b/src/view/com/post-thread/PostThread.tsx
@@ -129,17 +129,18 @@ export function PostThread({uri}: {uri: string | undefined}) {
     currentAccount &&
     rootPostUri &&
     currentAccount?.did === new AtUri(rootPostUri).host
+  const initialThreadgateRecord = rootPost?.threadgate?.record as
+    | AppBskyFeedThreadgate.Record
+    | undefined
   const {data: threadgateRecord} = useThreadgateRecordQuery({
     /**
      * If the user is the OP and the root post has a threadgate, we should load
      * the threadgate record. Otherwise, fallback to initialData, which is taken
      * from the response from `getPostThread`.
      */
-    enabled: Boolean(isOP && rootPostUri),
+    enabled: Boolean(isOP && rootPostUri && initialThreadgateRecord),
     postUri: rootPostUri,
-    initialData: rootPost?.threadgate?.record as
-      | AppBskyFeedThreadgate.Record
-      | undefined,
+    initialData: initialThreadgateRecord,
   })
 
   const moderationOpts = useModerationOpts()