From 5b511e2b96be6bfd4e64ab82bdbd3dfeebb416d2 Mon Sep 17 00:00:00 2001 From: Aurastic <33085835+ISenseAura@users.noreply.github.com> Date: Wed, 30 Jul 2025 17:04:26 +0530 Subject: [PATCH] Preact: Improve error when challenging without required team (#2484) --- play.pokemonshowdown.com/src/panel-mainmenu.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/play.pokemonshowdown.com/src/panel-mainmenu.tsx b/play.pokemonshowdown.com/src/panel-mainmenu.tsx index 34aa84ab0..c8366a9db 100644 --- a/play.pokemonshowdown.com/src/panel-mainmenu.tsx +++ b/play.pokemonshowdown.com/src/panel-mainmenu.tsx @@ -781,8 +781,15 @@ export class TeamForm extends preact.Component<{ submit = (ev: Event, validate?: 'validate') => { ev.preventDefault(); const format = this.format; - const teamKey = this.base!.querySelector('button[name=team]')!.value; + const teamElement = this.base!.querySelector('button[name=team]'); + const teamKey = teamElement!.value; const team = teamKey ? PS.teams.byKey[teamKey] : undefined; + if (!window.BattleFormats[toID(format)]?.team && !team) { + PS.alert('You need to go into the Teambuilder and build a team for this format.', { + parentElem: teamElement!, + }); + return; + } PS.teams.loadTeam(team).then(() => { (validate === 'validate' ? this.props.onValidate : this.props.onSubmit)?.(ev, format, team); });