mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-11 21:56:11 -05:00
Actually fix the hooks out of sync warning
This commit is contained in:
@@ -31,6 +31,14 @@ export function CheckinActions() {
|
||||
const [minutesTillCheckInCloses, setMinutesTillCheckInCloses] =
|
||||
React.useState(timeInMinutesBeforeCheckInCloses());
|
||||
|
||||
React.useEffect(() => {
|
||||
const timeout = setInterval(() => {
|
||||
setMinutesTillCheckInCloses(timeInMinutesBeforeCheckInCloses());
|
||||
}, 1000 * 15);
|
||||
|
||||
return () => clearTimeout(timeout);
|
||||
}, []);
|
||||
|
||||
const ownTeam = tournament.teams.find((team) =>
|
||||
team.members.some(
|
||||
({ member, captain }) => captain && member.id === user?.id
|
||||
@@ -42,14 +50,6 @@ export function CheckinActions() {
|
||||
return null;
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
const timeout = setInterval(() => {
|
||||
setMinutesTillCheckInCloses(timeInMinutesBeforeCheckInCloses());
|
||||
}, 1000 * 15);
|
||||
|
||||
return () => clearTimeout(timeout);
|
||||
}, []);
|
||||
|
||||
if (ownTeam.checkedInTime) {
|
||||
return (
|
||||
<ActionSectionWrapper icon="success" data-cy="checked-in-alert">
|
||||
|
||||
Reference in New Issue
Block a user