Description
A logic bug exists in the primary <RepositoryGrid /> sorting algorithm. The grid is designed to sort a user's repositories by total stars (descending). However, if a user has multiple repositories with the exact same star count (e.g., three repos with 0 stars, or two repos with 5 stars), the Array.prototype.sort() algorithm fails to implement a deterministic secondary sorting parameter. This causes the order of those specific repositories to flicker and change randomly every time the page is refreshed or a new batch is paginated.
Proposed Solution
- Audit the client-side (or server-side) sorting utility function applied to the repository array.
- Implement a robust, multi-tier sorting heuristic.
- The primary sort parameter must remain
stargazerCount (descending).
- Inject a strict secondary sort parameter: if
repoA.stargazerCount === repoB.stargazerCount, fallback to sorting by updatedAt (most recently pushed to first).
- This mathematically guarantees a 100% deterministic, stable rendering order across all sessions, completely eliminating the UI flicker and ensuring the user's most recently active projects are always prioritized in tie-breaker scenarios.
Description
A logic bug exists in the primary
<RepositoryGrid />sorting algorithm. The grid is designed to sort a user's repositories by total stars (descending). However, if a user has multiple repositories with the exact same star count (e.g., three repos with 0 stars, or two repos with 5 stars), theArray.prototype.sort()algorithm fails to implement a deterministic secondary sorting parameter. This causes the order of those specific repositories to flicker and change randomly every time the page is refreshed or a new batch is paginated.Proposed Solution
stargazerCount(descending).repoA.stargazerCount === repoB.stargazerCount, fallback to sorting byupdatedAt(most recently pushed to first).