evijit HF Staff Claude Sonnet 4.6 commited on
Commit
c9c5a30
·
1 Parent(s): 919a75f

Fix sort toggle direction and remove categories as sortable column

Browse files
Files changed (2) hide show
  1. app/evals/page.tsx +6 -14
  2. components/family-table.tsx +2 -2
app/evals/page.tsx CHANGED
@@ -51,15 +51,13 @@ function EvalsPageInner() {
51
  const deferredSearchQuery = useDeferredValue(searchQuery)
52
 
53
  const handleSort = useCallback((col: FamilySortCol) => {
54
- setSortCol((prev) => {
55
- if (prev === col) {
56
- setSortDir((d) => (d === "asc" ? "desc" : "asc"))
57
- return col
58
- }
59
  setSortDir("asc")
60
- return col
61
- })
62
- }, [])
63
 
64
  useEffect(() => {
65
  Promise.all([fetchEvalHierarchy(), fetchEvalList(), fetchBenchmarkMetadata()])
@@ -166,12 +164,6 @@ function EvalsPageInner() {
166
  case "name":
167
  cmp = a.display_name.localeCompare(b.display_name)
168
  break
169
- case "categories": {
170
- const aTag = (a.derivedTags ?? [])[0] ?? ""
171
- const bTag = (b.derivedTags ?? [])[0] ?? ""
172
- cmp = aTag.localeCompare(bTag)
173
- break
174
- }
175
  case "benchmarks":
176
  cmp = getFamilyBenchmarkCount(a) - getFamilyBenchmarkCount(b)
177
  break
 
51
  const deferredSearchQuery = useDeferredValue(searchQuery)
52
 
53
  const handleSort = useCallback((col: FamilySortCol) => {
54
+ if (sortCol === col) {
55
+ setSortDir((d) => (d === "asc" ? "desc" : "asc"))
56
+ } else {
57
+ setSortCol(col)
 
58
  setSortDir("asc")
59
+ }
60
+ }, [sortCol])
 
61
 
62
  useEffect(() => {
63
  Promise.all([fetchEvalHierarchy(), fetchEvalList(), fetchBenchmarkMetadata()])
 
164
  case "name":
165
  cmp = a.display_name.localeCompare(b.display_name)
166
  break
 
 
 
 
 
 
167
  case "benchmarks":
168
  cmp = getFamilyBenchmarkCount(a) - getFamilyBenchmarkCount(b)
169
  break
components/family-table.tsx CHANGED
@@ -12,7 +12,7 @@ import { humanizeEvaluationId } from "@/lib/utils"
12
 
13
  const LEAVES_INLINE_MAX = 50
14
 
15
- export type FamilySortCol = "name" | "categories" | "benchmarks" | "results"
16
 
17
  interface FamilyTableProps {
18
  families: HierarchyFamily[]
@@ -348,7 +348,7 @@ export function FamilyTable({
348
  <thead>
349
  <tr>
350
  <SortTh col="name" style={{ width: "55%" }}>Family</SortTh>
351
- <SortTh col="categories">Categories</SortTh>
352
  <SortTh col="benchmarks" className="num">Benchmarks</SortTh>
353
  <SortTh col="results" className="num">Reported results</SortTh>
354
  <th style={{ width: 90 }} />
 
12
 
13
  const LEAVES_INLINE_MAX = 50
14
 
15
+ export type FamilySortCol = "name" | "benchmarks" | "results"
16
 
17
  interface FamilyTableProps {
18
  families: HierarchyFamily[]
 
348
  <thead>
349
  <tr>
350
  <SortTh col="name" style={{ width: "55%" }}>Family</SortTh>
351
+ <th>Categories</th>
352
  <SortTh col="benchmarks" className="num">Benchmarks</SortTh>
353
  <SortTh col="results" className="num">Reported results</SortTh>
354
  <th style={{ width: 90 }} />