about summary refs log tree commit diff
path: root/src/state/queries/resolve-uri.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-11-10 15:34:25 -0800
committerGitHub <noreply@github.com>2023-11-10 15:34:25 -0800
commitc8c308e31e63607280648e3e9f1f56a371adcd05 (patch)
tree09cea4c603968a1a0b4cab299af9a417880c8115 /src/state/queries/resolve-uri.ts
parent51f04b96200e38d95e486628d3cbc43398c47980 (diff)
downloadvoidsky-c8c308e31e63607280648e3e9f1f56a371adcd05.tar.zst
Refactor feeds to use react-query (#1862)
* Update to react-query v5

* Introduce post-feed react query

* Add feed refresh behaviors

* Only fetch feeds of visible pages

* Implement polling for latest on feeds

* Add moderation filtering to slices

* Handle block errors

* Update feed error messages

* Remove old models

* Replace simple-feed option with disable-tuner option

* Add missing useMemo

* Implement the mergefeed and fixes to polling

* Correctly handle failed load more state

* Improve error and empty state behaviors

* Clearer naming
Diffstat (limited to 'src/state/queries/resolve-uri.ts')
-rw-r--r--src/state/queries/resolve-uri.ts17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/state/queries/resolve-uri.ts b/src/state/queries/resolve-uri.ts
index 770be5cf8..26e0a475b 100644
--- a/src/state/queries/resolve-uri.ts
+++ b/src/state/queries/resolve-uri.ts
@@ -6,12 +6,15 @@ export const RQKEY = (uri: string) => ['resolved-uri', uri]
 
 export function useResolveUriQuery(uri: string) {
   const {agent} = useSession()
-  return useQuery<string | undefined, Error>(RQKEY(uri), async () => {
-    const urip = new AtUri(uri)
-    if (!urip.host.startsWith('did:')) {
-      const res = await agent.resolveHandle({handle: urip.host})
-      urip.host = res.data.did
-    }
-    return urip.toString()
+  return useQuery<string | undefined, Error>({
+    queryKey: RQKEY(uri),
+    async queryFn() {
+      const urip = new AtUri(uri)
+      if (!urip.host.startsWith('did:')) {
+        const res = await agent.resolveHandle({handle: urip.host})
+        urip.host = res.data.did
+      }
+      return urip.toString()
+    },
   })
 }