From e1b213a54e8c53358d1aa18d6eacc490a708dc4d Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 13 Jul 2026 23:21:16 +0000 Subject: [PATCH] Fix: move useState(showChecklist) before conditional returns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit React hooks must be called unconditionally on every render. The checklist useState was at line 89, after 'if (loading) return' at line 70 — hooks violation crashed the entire React app (blank screen). Moved to line 38 with the other state declarations. --- frontend/src/pages/Dashboard.jsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/frontend/src/pages/Dashboard.jsx b/frontend/src/pages/Dashboard.jsx index e3b3f63..45012c5 100644 --- a/frontend/src/pages/Dashboard.jsx +++ b/frontend/src/pages/Dashboard.jsx @@ -35,6 +35,7 @@ export default function Dashboard() { const [aiStatus, setAiStatus] = useState(null) const [loading, setLoading] = useState(true) const [syncing, setSyncing] = useState(null) + const [showChecklist, setShowChecklist] = useState(() => localStorage.getItem("diligence_setup_dismissed") !== "true") const navigate = useNavigate() useEffect(() => { loadAll() }, []) @@ -85,11 +86,6 @@ export default function Dashboard() { { key: 'daily_checkin', label: 'Check-in', icon: '✅', pts: 10, color: '#00BCD4', tip: 'Just show up and check in. The easiest points — consistency matters more than intensity.' }, ] - // Getting-started checklist — shows until dismissed - const [showChecklist, setShowChecklist] = useState(() => { - return localStorage.getItem('diligence_setup_dismissed') !== 'true' - }) - const setupItems = [ { done: true, label: 'Create account', link: null }, { done: !!status.program_name, label: 'Join a program', link: '/programs' },