Fix server error when match does not yet have both teams set

This commit is contained in:
Kalle
2026-04-21 07:32:51 +03:00
parent 88072f8b02
commit 83b44e2bbf
2 changed files with 5 additions and 5 deletions

View File

@@ -147,18 +147,18 @@ export const loader = async ({ params }: LoaderFunctionArgs) => {
if (
match.chatCode &&
!matchIsOver &&
match.opponentOne &&
match.opponentTwo
match.opponentOne?.id &&
match.opponentTwo?.id
) {
// only add global chat for active roster (or all if not yet set i.e. first match)
// if roster changed mid-set the subs can still see the chat on the match page
const teamAlpha = tournament.teamById(match.opponentOne.id!)!;
const teamAlpha = tournament.teamById(match.opponentOne.id)!;
const teamAlphaActiveRoster =
tournamentTeamToActiveRosterUserIds(
teamAlpha,
tournament.minMembersPerTeam,
) ?? teamAlpha.members.map((m) => m.userId);
const teamBravo = tournament.teamById(match.opponentTwo.id!)!;
const teamBravo = tournament.teamById(match.opponentTwo.id)!;
const teamBravoActiveRoster =
tournamentTeamToActiveRosterUserIds(
teamBravo,

View File

@@ -866,7 +866,7 @@ test.describe("Tournament bracket", () => {
});
test("locks/unlocks matches & sets match as casted", async ({ page }) => {
test.setTimeout(120000);
test.slow();
const tournamentId = 2;