Skip to content

Commit

Permalink
Delay editing new tournaments until the group has loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
dexonsmith committed Feb 12, 2024
1 parent d6ec4d5 commit b7b7541
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/views/Tournament/Tournament.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ export function Tournament(): JSX.Element {
const players_loaded = raw_players !== null;
const loading = !rounds_loaded || !players_loaded || !tournament_loaded;

const new_tournament_group_loaded =
!new_tournament_group_id || new_tournament_group_id === (tournament.group?.id ?? 0);
const ready_to_edit = editing && new_tournament_group_loaded;

const use_elimination_trees = is_elimination(tournament.tournament_type);

const players: TournamentPlayers = raw_players === null ? {} : raw_players;
Expand Down Expand Up @@ -921,7 +925,7 @@ export function Tournament(): JSX.Element {
tournament.tournament_type === "opengotha" ||
null;

if (!tournament_loaded && !editing) {
if (!tournament_loaded && !ready_to_edit) {
return <LoadingPage />;
}

Expand Down

0 comments on commit b7b7541

Please sign in to comment.