Skip to content

Commit 63aeb67

Browse files
committed
Fixed react hooks violation
1 parent 5f9e96d commit 63aeb67

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/pages/Competition/Tabs/index.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,6 @@ export default function CompetitionTabs() {
9090
});
9191
}, [competitionId, hash, tabsWithSlugs, setOpenTabs]);
9292

93-
if (isLoading) {
94-
return (
95-
<Container className="p-2">
96-
<p className="type-body">{t('common.loading')}</p>
97-
</Container>
98-
);
99-
}
100-
101-
if (error || !tabs) {
102-
return (
103-
<Container className="p-2">
104-
<p className="type-body">{t('competition.tabs.error')}</p>
105-
</Container>
106-
);
107-
}
108-
10993
const handleToggle = useCallback(
11094
(slug: string) => {
11195
setOpenTabs((prev) => {
@@ -141,6 +125,22 @@ export default function CompetitionTabs() {
141125
}
142126
}, [competitionId, tabsWithSlugs]);
143127

128+
if (isLoading) {
129+
return (
130+
<Container className="p-2">
131+
<p className="type-body">{t('common.loading')}</p>
132+
</Container>
133+
);
134+
}
135+
136+
if (error || !tabs) {
137+
return (
138+
<Container className="p-2">
139+
<p className="type-body">{t('competition.tabs.error')}</p>
140+
</Container>
141+
);
142+
}
143+
144144
return (
145145
<div className="flex justify-center w-full">
146146
<Container className="p-2 space-y-4">

0 commit comments

Comments
 (0)