guard the unauthed chat status queries
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user