fix: move useState hook before conditional return in profile page
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m29s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 1m29s
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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 (
|
||||
<div className="flex h-full flex-col overflow-y-auto">
|
||||
<div className="flex flex-1 flex-col gap-8 p-6 lg:p-8 max-w-4xl mx-auto w-full">
|
||||
|
||||
Reference in New Issue
Block a user