Skip to content

Commit 636b676

Browse files
authored
Prevent one badge with missing group from making all the others disappear (#763)
Not the prettiest thing ever but beats not being able to see other badges at all. The empty group currently shows up as undefined in the badge modal.
1 parent cc791d2 commit 636b676

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

badges.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,15 @@ function initBadgeControls() {
351351
const subTabs = [];
352352
if (badgeTabGame || !badgeTabGroup)
353353
badgeTabGroup = 'all';
354-
let hasGroups = true;
354+
// Check for the presence of groups first just in case;
355+
// there have been instances of just some badges missing groups (this should not usually happen)
356+
// Assume no groups only if none of the badges have a group assigned.
357+
const hasGroups = !!Object.keys(gameBadges[game]).find(g => !!g);
355358

356359
for (const group in gameBadges[game]) {
357-
if (!group) {
358-
// Group name is empty, game's badges have no group subdivision.
360+
if (!hasGroups) {
361+
// Game's badges have no group subdivision; use current falsy value.
359362
badgeTabGroup = group;
360-
hasGroups = false;
361363
break;
362364
}
363365
const subTab = document.createElement('div');

0 commit comments

Comments
 (0)