diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index 3febcea..03fcdab 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -69,6 +69,10 @@ const Index = () => { loadingStatuses }); + // Always call hooks before any conditional returns + const { regularJobs, trackedJobs } = useCategorizedJobs(jobs, searchQuery); + const { totalJobs, totalProfit, totalRevenue, calculateJobRevenue, calculateJobProfit } = useJobMetrics(regularJobs); + if (loading) { return (
@@ -85,9 +89,6 @@ const Index = () => { ); } - const { regularJobs, trackedJobs } = useCategorizedJobs(jobs, searchQuery); - const { totalJobs, totalProfit, totalRevenue, calculateJobRevenue, calculateJobProfit } = useJobMetrics(regularJobs); - if (showJobForm) { return (