Skip to content

Commit 0cd8b67

Browse files
committed
fix: Identifier can be a string
1 parent d709fd7 commit 0cd8b67

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

app/utils/sorting-values.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ import { DimensionValue } from "@/domain/data";
33

44
import { DataCubeObservationsQuery } from "../graphql/query-hooks";
55

6-
const maybeInt = (s?: string) => {
7-
if (!s) {
6+
const maybeInt = (value?: string): number | string => {
7+
if (!value) {
88
return Infinity;
99
}
10-
try {
11-
return parseInt(s, 10);
12-
} catch {
13-
return s;
10+
11+
const maybeInt = parseInt(value, 10);
12+
13+
if (isNaN(maybeInt)) {
14+
return value;
1415
}
16+
17+
return maybeInt;
1518
};
1619

1720
export const makeDimensionValueSorters = (

0 commit comments

Comments
 (0)