From a76f7710e82cffe179b176074ca5ad5f4c6a4b15 Mon Sep 17 00:00:00 2001 From: sepehr Date: Sat, 16 May 2026 13:48:06 +0200 Subject: [PATCH] fix: move useState hook before conditional return in profile page The activeTab useState was called after the if(loading) return, violating React's Rules of Hooks and causing error #310 at runtime. Co-Authored-By: Claude Opus 4.7 --- frontend/src/app/dashboard/profile/page.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/src/app/dashboard/profile/page.tsx b/frontend/src/app/dashboard/profile/page.tsx index 89c4dc8..877fca5 100644 --- a/frontend/src/app/dashboard/profile/page.tsx +++ b/frontend/src/app/dashboard/profile/page.tsx @@ -71,6 +71,7 @@ export default function ProfilePage() { const [loadingPortal, setLoadingPortal] = useState(false); const [loadingCancel, setLoadingCancel] = useState(false); const [isClearing, setIsClearing] = useState(false); + const [activeTab, setActiveTab] = useState('account'); const [defaultLanguage, setDefaultLanguage] = useState(settings.defaultTargetLanguage); const token = typeof window !== 'undefined' ? localStorage.getItem('token') : null; @@ -162,9 +163,6 @@ export default function ProfilePage() { const docsPct = pct(docsUsed, docsLimit); const pagesPct = pct(pagesUsed, pagesLimit); - // Tab state for editorial pill toggle - const [activeTab, setActiveTab] = useState('account'); - return (