mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-24 04:22:10 -05:00
* Remove old code * Add prefetching * Elim bracket initial * Hide rounds with only byes * Round hiding logic * Align stuff * Add TODO * Adjustments * Deadline * Compactify button * Simulations * Round robin bracket initial * eventId -> tournamentId * seedByTeamId removed * Couple more TODOs * RR placements table * Locking matches * Extract TournamentStream component * Bracket streams * Remove extras for tournament-manager, misc * Fix E2E tests * Fix SKALOP_SYSTEM_MESSAGE_URL in env.example * TODOs * TODO moved to GitHub * Handle team changing in match cache invalidation * Fix streamer seeing undo last score button * Show "Sub" badge on team roster page * Show who didn't play yet on match teams preview * Ranked/unranked badge * Bracket hover show roster * Add lock/unlock match test * Fix score reporting
19 lines
484 B
TypeScript
19 lines
484 B
TypeScript
import * as React from "react";
|
|
|
|
/** Forces the component to rerender periodically*/
|
|
export function useAutoRerender(every?: "second" | "ten seconds") {
|
|
const [, setNow] = React.useState(new Date().getTime());
|
|
|
|
React.useEffect(() => {
|
|
const intervalTime = !every || every === "second" ? 1000 : 10000;
|
|
|
|
const interval = setInterval(() => {
|
|
setNow(new Date().getTime());
|
|
}, intervalTime);
|
|
|
|
return () => {
|
|
clearInterval(interval);
|
|
};
|
|
}, [every]);
|
|
}
|