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-16 18:26:22 -0800
committerGitHub <noreply@github.com>2023-11-16 18:26:22 -0800
commit357c752a213dbcf77e5333fa180cfef20a33842d (patch)
treee955e57cc1252b5fe759cde29185d62bb71bc339 /src/state/queries/resolve-uri.ts
parent3043b324681f1702ca53831701fb5cecd14c0efb (diff)
downloadvoidsky-357c752a213dbcf77e5333fa180cfef20a33842d.tar.zst
Move the current agent to a global and reset RQ queries on agent change (#1946)
Diffstat (limited to 'src/state/queries/resolve-uri.ts')
-rw-r--r--src/state/queries/resolve-uri.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/state/queries/resolve-uri.ts b/src/state/queries/resolve-uri.ts
index 370f2a5b6..dc8e7fbe1 100644
--- a/src/state/queries/resolve-uri.ts
+++ b/src/state/queries/resolve-uri.ts
@@ -1,20 +1,19 @@
 import {useQuery} from '@tanstack/react-query'
 import {AtUri} from '@atproto/api'
 
-import {useSession} from '#/state/session'
+import {getAgent} from '#/state/session'
 import {STALE} from '#/state/queries'
 
 export const RQKEY = (uri: string) => ['resolved-uri', uri]
 
 export function useResolveUriQuery(uri: string | undefined) {
-  const {agent} = useSession()
   return useQuery<{uri: string; did: string}, Error>({
     staleTime: STALE.INFINITY,
     queryKey: RQKEY(uri || ''),
     async queryFn() {
       const urip = new AtUri(uri || '')
       if (!urip.host.startsWith('did:')) {
-        const res = await agent.resolveHandle({handle: urip.host})
+        const res = await getAgent().resolveHandle({handle: urip.host})
         urip.host = res.data.did
       }
       return {did: urip.host, uri: urip.toString()}