Skip to content

Commit cdc0f60

Browse files
committed
fix(api): inverts workflow sort comparators to descending (most recent first)
1 parent cc98513 commit cdc0f60

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/app/services/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,14 +1022,14 @@ export async function fetchWorkflowRuns(
10221022
runs,
10231023
latestAt: runs.reduce((max, r) => r.updated_at > max ? r.updated_at : max, ""),
10241024
}));
1025-
workflowEntries.sort((a, b) => b.latestAt > a.latestAt ? -1 : b.latestAt < a.latestAt ? 1 : 0);
1025+
workflowEntries.sort((a, b) => b.latestAt > a.latestAt ? 1 : b.latestAt < a.latestAt ? -1 : 0);
10261026
const topWorkflows = workflowEntries
10271027
.slice(0, maxWorkflows);
10281028

10291029
// Take most recent M runs per workflow
10301030
for (const { runs: workflowRuns } of topWorkflows) {
10311031
const sorted = workflowRuns.sort(
1032-
(a, b) => b.created_at > a.created_at ? -1 : b.created_at < a.created_at ? 1 : 0
1032+
(a, b) => b.created_at > a.created_at ? 1 : b.created_at < a.created_at ? -1 : 0
10331033
);
10341034
for (const run of sorted.slice(0, maxRuns)) {
10351035
allRuns.push({

0 commit comments

Comments
 (0)