From bd4fc357937399ba458bc36cb72d0a601bb58b95 Mon Sep 17 00:00:00 2001 From: Aj Wazzan Date: Thu, 8 May 2025 23:22:19 -0700 Subject: [PATCH] fix: ensure thread refetching only occurs when threadId is available --- apps/mail/components/create/ai-chat.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/mail/components/create/ai-chat.tsx b/apps/mail/components/create/ai-chat.tsx index a1eb9caeb..7a01b225e 100644 --- a/apps/mail/components/create/ai-chat.tsx +++ b/apps/mail/components/create/ai-chat.tsx @@ -154,10 +154,10 @@ export function AIChat() { const refetchAll = useCallback(() => { refetchLabels(); refetchStats(); - refetchThread(); + if (threadId) refetchThread(); queryClient.invalidateQueries({ queryKey: trpc.mail.get.queryKey() }); refetch(); - }, [refetchLabels, refetchStats, refetchThread, queryClient, trpc.mail.get.queryKey]); + }, [threadId, queryClient, trpc.mail.get.queryKey]); useEffect(() => { if (prevStatusRef.current === 'streaming' && status === 'ready') {