about summary refs log tree commit diff
path: root/src/state/queries
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/queries')
-rw-r--r--src/state/queries/post.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/state/queries/post.ts b/src/state/queries/post.ts
index f27628d69..794f48eb1 100644
--- a/src/state/queries/post.ts
+++ b/src/state/queries/post.ts
@@ -18,7 +18,16 @@ export function usePostQuery(uri: string | undefined) {
   return useQuery<AppBskyFeedDefs.PostView>({
     queryKey: RQKEY(uri || ''),
     async queryFn() {
-      const res = await agent.getPosts({uris: [uri!]})
+      const urip = new AtUri(uri!)
+
+      if (!urip.host.startsWith('did:')) {
+        const res = await agent.resolveHandle({
+          handle: urip.host,
+        })
+        urip.host = res.data.did
+      }
+
+      const res = await agent.getPosts({uris: [urip.toString()]})
       if (res.success && res.data.posts[0]) {
         return res.data.posts[0]
       }
@@ -47,7 +56,7 @@ export function useGetPost() {
           }
 
           const res = await agent.getPosts({
-            uris: [urip.toString()!],
+            uris: [urip.toString()],
           })
 
           if (res.success && res.data.posts[0]) {