Description
When navigating to the very last page of the leaderboard, there is a severe performance freeze/lag. This is because all inactive users (those with a score of 0 in the overall leaderboard) are appended to the table at the same time without any pagination:
if (inactiveList.length > 0 && (currentPage === totalPages || isSearching)) {
inactiveList.forEach((user) => {
body.appendChild(renderLeaderboardRow(user, ""));
mobileCards.appendChild(renderMobileCard(user, ""));
});
}
As the database of registered users grows, this results in hundreds of DOM node insertions simultaneously, causing the browser thread to lock up.
To Reproduce
Navigate to the /leaderboard.
Click on the last page number in the pagination.
Observe the layout freeze / render lag.
Suggested Fix
Move inactive users to a separate, dedicated "Inactive Users" tab to prevent loading them on the primary leaderboard view.
Alternatively, paginate the inactive list separately so they are loaded incrementally
Description
When navigating to the very last page of the leaderboard, there is a severe performance freeze/lag. This is because all inactive users (those with a score of
0in the overall leaderboard) are appended to the table at the same time without any pagination:As the database of registered users grows, this results in hundreds of DOM node insertions simultaneously, causing the browser thread to lock up.
To Reproduce
Navigate to the /leaderboard.
Click on the last page number in the pagination.
Observe the layout freeze / render lag.
Suggested Fix
Move inactive users to a separate, dedicated "Inactive Users" tab to prevent loading them on the primary leaderboard view.
Alternatively, paginate the inactive list separately so they are loaded incrementally