fix(leaderboard): make rank column reflect active sort column and dir…#1170
Open
Khaostica wants to merge 1 commit into
Open
fix(leaderboard): make rank column reflect active sort column and dir…#1170Khaostica wants to merge 1 commit into
Khaostica wants to merge 1 commit into
Conversation
…ection Previously the rank column showed a stable position in totalScore desc no matter which column was being sorted by, and ASC sorts left ranks anchored to the input order via sort stability — so the gold/silver/bronze podium glow on rank 1 could land on miners that weren't first in the visible list, and clicking ASC on any column produced a rank column that didn't mirror DESC. Recompute rank from the active sort metric (descending = canonical), then reverse for ASC. Filters still apply downstream, leaving the surviving rows with their original (column-specific) rank values. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In the list view of the leaderboards (
/top-miners,/discoveries,/watchlist), the Rank column was just "row number in the current sort" — re-numbered starting at1from the top regardless of direction. Two visible symptoms came out of that:The gold/silver/bronze "1/2/3" badges landed on the worst miners in any ascending sort. Sort Credibility ascending (ASC) and the miner with the lowest credibility shows up at the top of the list with the gold "# 1" badge. Same for Score ASC, Earnings ASC, etc.
ASC and descending (DESC) of the same column didn't mirror each other. Because rank was always re-numbered from the top, flipping direction reshuffled the rank values across miners instead of just turning the list upside-down. The same miner could be rank "1" in ASC and rank "N" in DESC, even though their actual standing hadn't moved.
Fix
rankedMinersinTopMinersTable.tsxnow derives rank from the active column in its descending (canonical) direction, then reverses the list for ASC. Rank "1" / the gold badge consistently means "best by the column you're viewing," and ASC of any column isN, N-1, … 1top-to-bottom — so the last-place miner shows up at the top with their actual last-place rank. Filters still apply downstream and never renumber.Type of Change
Screenshots
Before:


After:


Additional Video
Trimmed.Leaderboard.Fix.Demo.mp4
Checklist
npm run formatandnpm run lint:fixhave been runnpm run buildpasses