diff --git a/js/client.js b/js/client.js index b6a7234862..a259762549 100644 --- a/js/client.js +++ b/js/client.js @@ -555,7 +555,12 @@ function toId() { }); this.on('loggedin', function () { - Storage.loadRemoteTeams(); + Storage.loadRemoteTeams(function () { + if (app.rooms.teambuilder) { + // if they have it open, be sure to update so it doesn't show 'no teams' + app.rooms.teambuilder.update(); + } + }); }); this.on('response:savereplay', this.uploadReplay, this); diff --git a/js/storage.js b/js/storage.js index 380241b9b9..6b9fc7d169 100644 --- a/js/storage.js +++ b/js/storage.js @@ -585,7 +585,7 @@ Storage.loadTeams = function () { } catch (e) {} }; -Storage.loadRemoteTeams = function () { +Storage.loadRemoteTeams = function (after) { $.get(app.user.getActionPHP(), {act: 'getteams'}, Storage.safeJSON(function (data) { if (data.actionerror) { return app.addPopupMessage('Error loading uploaded teams: ' + data.actionerror); @@ -615,6 +615,7 @@ Storage.loadRemoteTeams = function () { Storage.teams.push(team); } } + if (typeof after === 'function') after(); })); };