()
| 89 | * Prefetch a remote chat on hover (for instant loading when clicked) |
| 90 | */ |
| 91 | export function usePrefetchRemoteChat() { |
| 92 | const queryClient = useQueryClient() |
| 93 | |
| 94 | return useCallback( |
| 95 | (chatId: string) => { |
| 96 | queryClient.prefetchQuery({ |
| 97 | queryKey: ["remote-chat", chatId], |
| 98 | queryFn: () => remoteApi.getAgentChat(chatId), |
| 99 | staleTime: 60 * 1000, |
| 100 | }) |
| 101 | }, |
| 102 | [queryClient] |
| 103 | ) |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Fetch archived remote chats for the selected team |