Skip to content

Commit 59910ac

Browse files
committed
try and fix ordering
1 parent 5eee64b commit 59910ac

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/Mdx.res

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ external childrenToString: {..} => string = "toString"
5959
let sortSection = mdxPages =>
6060
Array.toSorted(mdxPages, (a: attributes, b: attributes) =>
6161
switch (a.order, b.order) {
62-
| (Some(a), Some(b)) => a > b ? 1.0 : -1.0
62+
| (Some(orderA), Some(orderB)) =>
63+
switch Int.compare(orderA, orderB) {
64+
| 0 => String.compare(a.title, b.title)->Int.toFloat
65+
| result => result->Int.toFloat
66+
}
6367
| (Some(_), None) => -1.0
6468
| (None, Some(_)) => 1.0
65-
| (None, None) => 0.0
69+
| (None, None) => String.compare(a.title, b.title)->Int.toFloat
6670
}
6771
)
6872

0 commit comments

Comments
 (0)