From 31709077e5820cd1351a7062d30bfec1aa9c09d4 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 1 Sep 2024 11:08:43 +0300 Subject: [PATCH] Fix swiss bracket prepared maps crash Closes #1870 --- .../tournament-bracket/components/BracketMapListDialog.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/features/tournament-bracket/components/BracketMapListDialog.tsx b/app/features/tournament-bracket/components/BracketMapListDialog.tsx index 8152a4c79..dcfbedac0 100644 --- a/app/features/tournament-bracket/components/BracketMapListDialog.tsx +++ b/app/features/tournament-bracket/components/BracketMapListDialog.tsx @@ -543,9 +543,10 @@ function teamCountAdjustedBracketData({ teamCount, }: { bracket: Bracket; tournament: Tournament; teamCount: number }) { switch (bracket.type) { - // RR & swiss are different because for those the amount of participants won't affect the amount of rounds - case "round_robin": case "swiss": + // always has the same amount of rounds even if 0 participants + return bracket.data; + case "round_robin": // 10 to ensure a full bracket gets generated even if registration is underway return tournament.generateMatchesData( nullFilledArray(10).map((_, i) => i + 1),