Breaking Changes: - Removed useAutoUsageQuery hook (119 lines) - Unified all usage queries into single useUsageQuery hook Technical Improvements: - Eliminated duplicate state management (React Query + manual useState) - Fixed single source of truth principle violation - Replaced manual setInterval with React Query's built-in refetchInterval - Reduced UsageFooter complexity by 28% (54 → 39 lines) New Features: - useUsageQuery now accepts autoQueryInterval option - Automatic query interval control (0 = disabled, min 1 minute) - Built-in lastQueriedAt timestamp from dataUpdatedAt - Auto-query only enabled for currently active provider Architecture Benefits: - Single data source: manual and auto queries share same cache - No more state inconsistency between manual/auto query results - Leverages React Query's caching, deduplication, and background updates - Cleaner separation of concerns Code Changes: - src/lib/query/queries.ts: Enhanced useUsageQuery with auto-query support - src/components/UsageFooter.tsx: Simplified to use single query hook - src/hooks/useAutoUsageQuery.ts: Deleted (redundant) - All type checks passed
7.2 KiB
7.2 KiB