diff --git a/src/hooks/useGitFetch.ts b/src/hooks/useGitFetch.ts index 60831ff3..529a4e9d 100644 --- a/src/hooks/useGitFetch.ts +++ b/src/hooks/useGitFetch.ts @@ -1,31 +1,34 @@ import { useQuery } from '@tanstack/react-query'; import { useGit } from './useGit'; +interface GitFetchResult { + defaultBranch: string | null; + fetchHead: string | null; + fetchHeadDescription: string | null; +} + export function useGitFetch(dir: string | undefined) { const { git } = useGit(); const query = useQuery({ queryKey: ['git-fetch', dir], - queryFn: async (): Promise => { - if (!dir) { - return; - } - - try { - + queryFn: async (): Promise => { + if (dir) { try { - await git.fetch({ + return await git.fetch({ dir, }); } catch (error) { // Fetch failed, but don't throw - just log and return null console.warn('Git fetch failed:', error); - return; } - } catch (error) { - console.error('Error during git fetch:', error); - return; } + + return { + defaultBranch: null, + fetchHead: null, + fetchHeadDescription: null, + }; }, enabled: !!dir, refetchInterval: 60000, // Fetch every 60 seconds