Skip to content

perf: paginate inactive users on leaderboard to prevent layout freeze (#299)#327

Merged
jagdish-15 merged 2 commits into
codepvg:mainfrom
yashvi-3106:perf-paginate-inactive-users
Jul 18, 2026
Merged

perf: paginate inactive users on leaderboard to prevent layout freeze (#299)#327
jagdish-15 merged 2 commits into
codepvg:mainfrom
yashvi-3106:perf-paginate-inactive-users

Conversation

@yashvi-3106

Copy link
Copy Markdown
Contributor

Description

Resolves a performance freeze/lag when navigating to the last page of the leaderboard. This occurred because all inactive users (those with an overall score of 0) were loaded and appended to the table at the same time on the last page. Paginating inactive users incrementally within the unified leaderboard array avoids this rendering lockup.

Linked Issue

Fixes #299

Changes Made

  • Combined active users (overall score > 0) and inactive users (overall score 0) into a single unified leaderboard array (combinedData) in applyFiltersAndRender().
  • Calculated all pagination attributes (totalPages, startRow, endRow) and stats based on the unified array length.
  • Updated renderLeaderboard() to slice the combined array per page and dynamically insert the ── [ SECTION: NO ACTIVITY YET ] ── divider row/card before the first inactive user.
  • Correctly computed active user ranks based on their active list index (or originalRank) and set inactive user ranks to "".

Type of Change

  • Bug fix
  • New feature
  • UI/Visual update
  • Documentation update
  • Refactor

Testing

  • Tested locally
  • Tested on mobile viewport (if applicable)
  • No console errors introduced

Checklist

  • My code follows the project's coding style
  • I have formatted my code locally by running npx prettier --write . before submitting
  • I am submitting my PR from a dedicated feature/* branch, not the main branch
  • I have performed a self-review of my code
  • My changes generate no new warnings or errors
  • I have updated documentation if required
  • I have linked the relevant issue

Screenshots / Screen Recording

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for submitting a pull request.

Please ensure your changes comply with the project's contribution guidelines and that all workflow checks pass successfully.

Formatting and Branching

  • Please confirm you have formatted your code locally using npx prettier --write . before requesting a review.
  • Ensure this PR is made from a feature/* branch and not main.

Note: This project is currently maintained by a solo maintainer, so reviews and responses may sometimes take a little time. Thanks for your patience.

@jagdish-15
jagdish-15 merged commit 3a95720 into codepvg:main Jul 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: Paginate or lazy-render the "No Activity Yet" user section to prevent layout freezing on the last page

2 participants