Skip to content

Commit f7f9d7d

Browse files
committed
fix: fix sorting of workflows in the results page
1 parent 8c3849a commit f7f9d7d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/features/results/ResultCards.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const mapToCardObjs = (
2424
tasks: TaskSummary[],
2525
workflows: RunningWorkflowSummary[],
2626
): ResultCardItem[] => {
27-
const todayIso = dayjs().toISOString();
2827
const instanceCardObjs = instances.map((instance) => ({
2928
type: "instance" as const,
3029
data: instance,
@@ -33,7 +32,7 @@ const mapToCardObjs = (
3332
const workflowCardObjs = workflows.map((workflow) => ({
3433
type: "workflow" as const,
3534
data: workflow,
36-
time: todayIso,
35+
time: workflow.started ?? dayjs().toISOString(), // Use the `started` property for workflows
3736
}));
3837
return [...instanceCardObjs, ...taskCardObjs, ...workflowCardObjs];
3938
};
@@ -110,7 +109,7 @@ export const ResultCards = ({
110109
.sort((a, b) => {
111110
const aTime = getTime(a);
112111
const bTime = getTime(b);
113-
return dayjs(aTime).isBefore(dayjs(bTime)) ? 1 : -1;
112+
return dayjs(bTime).isBefore(dayjs(aTime)) ? -1 : 1;
114113
})
115114
.map((item) => {
116115
switch (item.type) {

0 commit comments

Comments
 (0)