fix(miners): Score sort matches displayed value and Repository is sortable#279
Merged
anderdc merged 1 commit intoentrius:testfrom Apr 15, 2026
Merged
Conversation
…table The Score column's sort comparator unconditionally read `pr.score`, while the cell's render fallback chain shows `collateralScore` for open PRs, `score` for merged PRs, and `-` for closed-unmerged. Clicking Score on a miner with many open PRs collapsed all of them to a single sort key (`0`), so the visible collateral column never reordered. Extract `getEffectiveScore(pr)` that mirrors the render fallback exactly and use it in the `'score'` case. Also add `'repository'` to `PrSortField` with a `localeCompare` comparator and a `pullRequestNumber` tiebreaker, and wrap the Repository header in `<TableSortLabel>`. Introduce a `DEFAULT_SORT_DIR` map so each column has a self-documenting natural direction (string columns ascending, numeric/date descending), and `handleSort` reads from it instead of branching on the field name. Closes entrius#276
ec93c7f to
b710f45
Compare
anderdc
approved these changes
Apr 15, 2026
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
On the Miner Details page's PR table (
/miners/details?githubId=<id>&tab=pull-requests):pr.scoreunconditionally while the cell's render fallback showscollateralScorefor open PRs,scorefor merged PRs, and-for closed-unmerged. Every open PR collapsed to sort key0and clicking Score never reordered them. Verified against miner42954461: 17 open PRs, allpr.score = "0.000000",collateralScoreranging from0.001to0.370→ old comparator had 1 distinct sort key, new comparator has 17.<TableCell>Repository</TableCell>with no click target, even though the other five columns are sortable.Changes —
src/components/miners/MinerPRsTable.tsxgetEffectiveScore(pr)helper mirrors the Score cell's render fallback exactly (CLOSED && !mergedAt → 0,!mergedAt && collateralScore → parseFloat(collateralScore), elseparseFloat(score)). Used in the'score'sort case so the sort key matches the displayed value.'repository'added toPrSortFieldwitha.repository.localeCompare(b.repository)and apullRequestNumbertiebreaker. Within a single repo, rows get a deterministic order that flips with the primary sort direction.DEFAULT_SORT_DIR: Record<PrSortField, SortDir>map centralizes each column's natural idle direction (string columns ascending, numeric/date descending).handleSortreads from it instead of branching on the field name, so adding Title/Author sort in the future is a one-line map entry.<TableSortLabel>consistent with PR #, +/-, Score, Date. Idle-state direction pulled fromDEFAULT_SORT_DIR.repository.Diff stat: 1 file, +40 / −4.
Related Issues
Closes #276
Type of Change
Screenshots
Before:
Screencast.from.2026-04-15.01-53-43.webm
Clicking Score on miner
42954461leaves the open-PR rows (marked "Collateral") in API order. Repository header is static.After:
Screencast.from.2026-04-15.01-51-27.webm
Same miner, same clicks. Score now reorders open-PR rows by their displayed collateral value (highest-first, then lowest-first on toggle). Repository is a sortable header that groups rows by
owner/repowith apullRequestNumbertiebreaker.Checklist
npm run formatandnpm run lint:fixhave been runnpm run buildpasses