mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-03-21 17:50:29 -05:00
Teambuilder: Cache failures for formats without resources
This commit is contained in:
parent
c382954e0c
commit
68a5ce5250
|
|
@ -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();
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user