Skip to content

Commit f9c66f1

Browse files
authored
only retrieve most recent workflow run for dashboard purposes (#3)
1 parent 846f686 commit f9c66f1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

frontend/src/routes/actions-dashboard.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,17 @@ const loadRepositories = async () => {
4545
const workflowRunsbyWorkflow = workflowRuns.results.filter(
4646
(run) => run.workflow === workflow.node_id
4747
);
48+
const mostRecentRun = workflowRunsbyWorkflow.reduce(
49+
(latest, current) => {
50+
return new Date(current.updated_at) > new Date(latest.updated_at)
51+
? current
52+
: latest;
53+
},
54+
workflowRunsbyWorkflow[0] || null
55+
);
4856
return {
4957
...workflow,
50-
runs: workflowRunsbyWorkflow,
58+
runs: [mostRecentRun],
5159
};
5260
}
5361
);

0 commit comments

Comments
 (0)