Skip to content

Commit 3af0bda

Browse files
fix(leaderboard): prevent duplicate initialization and early render (#13)
1 parent 2eb3263 commit 3af0bda

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

frontend/leaderboard.html

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,14 @@ <h1 class="page-title">Leaderboard</h1>
143143
tab.classList.add('active');
144144
}
145145
});
146-
146+
147+
if (!leaderboardData[activeTab]) {
148+
return;
149+
}
150+
147151
renderLeaderboard(leaderboardData[activeTab]);
148152
}
149153

150-
document.addEventListener('DOMContentLoaded', () => {
151-
document.querySelectorAll('.tab').forEach(tab => {
152-
tab.addEventListener('click', () => {
153-
setActiveTab(tab.dataset.tab);
154-
});
155-
});
156-
157-
setActiveTab('overall');
158-
});
159154
</script>
160155
</body>
161156
</html>

0 commit comments

Comments
 (0)