Skip to content

Commit

Permalink
Teambuilder: Cache failures for formats without resources
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-pi-git committed Feb 29, 2024
1 parent c382954 commit 68a5ce5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions play.pokemonshowdown.com/js/client-teambuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
},
Expand Down

0 comments on commit 68a5ce5

Please sign in to comment.