guard the unauthed chat status queries

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-03 16:50:45 +03:00
parent aad0846ec0
commit 2c779615df
2 changed files with 6 additions and 3 deletions
@@ -1,7 +1,7 @@
import {type DidString} from '@atproto/syntax'
import {useQuery} from '@tanstack/react-query'
import {useChatClient} from '#/state/session'
import {useChatClient, useSession} from '#/state/session'
import {chat} from '#/lexicons'
import {STALE} from '..'
@@ -13,6 +13,7 @@ export function useGetConvoAvailabilityQuery(
{enabled = true}: {enabled?: boolean} = {},
) {
const client = useChatClient()
const {hasSession} = useSession()
return useQuery({
queryKey: RQKEY(did),
@@ -23,6 +24,6 @@ export function useGetConvoAvailabilityQuery(
})
},
staleTime: STALE.INFINITY,
enabled,
enabled: enabled && hasSession,
})
}
+3 -1
View File
@@ -1,6 +1,6 @@
import {useQuery} from '@tanstack/react-query'
import {useChatClient} from '#/state/session'
import {useChatClient, useSession} from '#/state/session'
import {chat} from '#/lexicons'
import {STALE} from '..'
import {createQueryKey} from '../util'
@@ -10,6 +10,7 @@ const chatActorStatusQueryKey = () =>
export function useChatActorStatusQuery() {
const client = useChatClient()
const {hasSession} = useSession()
return useQuery({
gcTime: STALE.INFINITY,
@@ -18,5 +19,6 @@ export function useChatActorStatusQuery() {
queryFn: async () => {
return await client.call(chat.bsky.actor.getStatus)
},
enabled: hasSession,
})
}