diff --git a/src/state/queries/messages/get-convo-availability.ts b/src/state/queries/messages/get-convo-availability.ts index 775dcceab0..0bed74d439 100644 --- a/src/state/queries/messages/get-convo-availability.ts +++ b/src/state/queries/messages/get-convo-availability.ts @@ -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, }) } diff --git a/src/state/queries/messages/get-status.ts b/src/state/queries/messages/get-status.ts index a785152603..465d442cb6 100644 --- a/src/state/queries/messages/get-status.ts +++ b/src/state/queries/messages/get-status.ts @@ -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, }) }