From 68a5ce52508357ef25106919e8910fa1f1db2891 Mon Sep 17 00:00:00 2001 From: Mia <49593536+mia-pi-git@users.noreply.github.com> Date: Wed, 28 Feb 2024 20:37:11 -0600 Subject: [PATCH] Teambuilder: Cache failures for formats without resources --- play.pokemonshowdown.com/js/client-teambuilder.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/play.pokemonshowdown.com/js/client-teambuilder.js b/play.pokemonshowdown.com/js/client-teambuilder.js index 22189c6e2d..597f103b2e 100644 --- a/play.pokemonshowdown.com/js/client-teambuilder.js +++ b/play.pokemonshowdown.com/js/client-teambuilder.js @@ -181,12 +181,14 @@ tryLoadFormatResource: function (format) { var teambuilder = this; - if (teambuilder.formatResources[format]) { // already loading, bypass + if (format in teambuilder.formatResources) { // already loading, bypass return; } + console.log(`called for ${format}`); teambuilder.formatResources[format] = true; // true - loading, array - loaded $.get('https://www.smogon.com/dex/api/formats/by-ps-name/' + format, {}, function (data) { - teambuilder.formatResources[format] = data; + // if the data doesn't exist, set it to true so it stops trying to load it + teambuilder.formatResources[format] = data || true; teambuilder.update(); }); },