diff --git a/apps/mail/hooks/driver/use-move-to.ts b/apps/mail/hooks/driver/use-move-to.ts index 1705c5cf1..c64284f00 100644 --- a/apps/mail/hooks/driver/use-move-to.ts +++ b/apps/mail/hooks/driver/use-move-to.ts @@ -9,6 +9,7 @@ import { useQueryState } from 'nuqs'; import { useState } from 'react'; import { useAtom } from 'jotai'; import { toast } from 'sonner'; +import { useTRPC } from '@/providers/query-provider'; const useMoveTo = () => { const t = useTranslations(); @@ -20,6 +21,7 @@ const useMoveTo = () => { const [, setFocusedIndex] = useAtom(focusedIndexAtom); const [, setThreadId] = useQueryState('threadId'); const [, setActiveReplyId] = useQueryState('activeReplyId'); + const trpc = useTRPC(); const getCopyByDestination = (to?: MoveThreadOptions['destination']) => { switch (to) { @@ -77,6 +79,9 @@ const useMoveTo = () => { }, finally: async () => { setIsLoading(false); + trpc.queryClient.invalidateQueries({ + queryKey: trpc.mail.listThreads.queryKey(), + }); await Promise.all([refetchThreads(), refetchStats()]); for (const threadId of threadIds) { deleteFromQueue(threadId);