import { useQuery } from '@tanstack/react-query' import { library, type LibraryStats } from '../services/api' export const LIBRARY_STATS_QUERY_KEY = ['library', 'stats'] as const /** * Per-section counts for the LeftSidebar badges (All Photos, Rated, * Duplicates, Discarded). Cached briefly so navigating around doesn't * re-fetch on every click; invalidated on photo mutations through the * standard ['photos'] invalidation in the mutation onSuccess paths. */ export function useLibraryStatsQuery() { return useQuery({ queryKey: LIBRARY_STATS_QUERY_KEY, queryFn: library.stats, staleTime: 30_000, }) }