Skip to content

Commit 5a5568a

Browse files
Fix FE number sort when changing sort order (#626)
1 parent 25aff1a commit 5a5568a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/table/sort.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export function descendingComparator<T>(a: T, b: T, orderBy: keyof T, order: Sor
22
// first attempt to parse into a numeric value and compare
33
const numCompare = descendingNumComparator(a, b, orderBy);
44
if (numCompare !== null) {
5-
return numCompare;
5+
return order === 'desc' ? numCompare : numCompare * -1;
66
}
77

88
// if non-numeric, compare using the javascript built-in compare for this type

0 commit comments

Comments
 (0)