Skip to content

[PERFORMANCE] : GitRank.jsx: Unpaginated live leaderboard listener causes scaling bottleneck and high Firestore read costs #65

@MayurKharat0390

Description

@MayurKharat0390

Is your feature request related to a problem?

❌ Describe the bug

On the GitRank Rating Engine page (/dashboard/gitrank), the global leaderboard mounts a real-time listener using Firestore's onSnapshot on the users collection:

const q = query(
  collection(db, "users"),
  where("onboardingStatus", "==", "complete")
);

### Describe the solution you'd like

// Sort by totalPoints descending
users.sort((a, b) => (b.points?.totalPoints || 0) - (a.points?.totalPoints || 0));

// Assign ranks
const ranked = users.map((u, i) => ({
  ...u,
  rank: i + 1
}));

### Describe alternatives you've considered

_No response_

### Mockups/Screenshots

_No response_

### Before submitting

- [x] I have read the [Contributing Guidelines](https://github.com/indresh404/RankerHub/blob/main/docs/CONTRIBUTING.md)
- [x] I have checked for duplicate feature requests.
- [x] I have discussed this idea in [Discussions](https://github.com/indresh404/RankerHub/discussions) (especially if it is a major feature).

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions