diff --git a/ui/desktop/src/hooks/useChat.ts b/ui/desktop/src/hooks/useChat.ts index 7db74e5a6e65..b7d09ea58841 100644 --- a/ui/desktop/src/hooks/useChat.ts +++ b/ui/desktop/src/hooks/useChat.ts @@ -1,6 +1,7 @@ import { useEffect, useState } from 'react'; import { ChatType } from '../types/chat'; import { fetchSessionDetails, generateSessionId } from '../sessions'; +import { ensureClientInitialized } from '../utils'; import { View, ViewOptions } from '../App'; type UseChatArgs = { @@ -29,6 +30,7 @@ export const useChat = ({ setIsLoadingSession, setView, setPairChat }: UseChatAr setIsLoadingSession(true); try { + await ensureClientInitialized(); const sessionDetails = await fetchSessionDetails(resumeSessionId); // Only set view if we have valid session details