Preact: Fix team requirement logic for custom named tournaments (#2579)

This commit is contained in:
Aurastic 2026-03-15 16:57:08 +05:30 committed by GitHub
parent 7df45ea835
commit ebe6dee892
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -830,10 +830,12 @@ export class TeamForm extends preact.Component<{
submit = (ev: Event, validate?: 'validate') => {
ev.preventDefault();
let format = this.format;
// in tournaments, format is the custom name & teamFormat is the original format.
const teambuilderFormat = this.props.teamFormat || PS.teams.teambuilderFormat(format);
const teamElement = this.base!.querySelector<HTMLButtonElement>('button[name=team]');
const teamKey = teamElement!.value;
const team = teamKey ? PS.teams.byKey[teamKey] : undefined;
if (!window.BattleFormats[PS.teams.teambuilderFormat(format)]?.team && !team) {
if (!window.BattleFormats[teambuilderFormat]?.team && !team) {
PS.alert('You need to go into the Teambuilder and build a team for this format.', {
parentElem: teamElement!,
});