From 2e9bcc3463a8fbf55a4dd35aaf94227170bf3272 Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Mon, 6 Jan 2025 09:13:05 -0800 Subject: [PATCH] Use API order instead of reordering timeline (#1503) --- .../routes/workflows/workflowRun/WorkflowRunTimeline.tsx | 8 ++++---- .../workflowRun/WorkflowRunTimelineBlockItem.tsx | 2 +- .../routes/workflows/workflowRun/workflowTimelineUtils.ts | 6 ++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx index d2cdad89..9118c84f 100644 --- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx +++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunTimeline.tsx @@ -56,8 +56,6 @@ function WorkflowRunTimeline({ const workflowRunIsNotFinalized = statusIsNotFinalized(workflowRun); - const timeline = workflowRunTimeline.slice().reverse(); - const numberOfActions = workflowRunTimeline.reduce((total, current) => { if (isTaskVariantBlockItem(current)) { return total + current.block!.actions!.length; @@ -98,8 +96,10 @@ function WorkflowRunTimeline({ )} - {timeline.length === 0 &&
Workflow timeline is empty
} - {timeline?.map((timelineItem) => { + {workflowRunTimeline.length === 0 && ( +
Workflow timeline is empty
+ )} + {workflowRunTimeline?.map((timelineItem) => { if (isBlockItem(timelineItem)) { return ( 0) { - const last = timeline.length - 1; - const timelineItem = timeline![last]; + const timelineItem = timeline![0]; if (isBlockItem(timelineItem)) { if ( timelineItem.block.actions && timelineItem.block.actions.length > 0 ) { - const last = timelineItem.block.actions.length - 1; - return timelineItem.block.actions[last]!; + return timelineItem.block.actions[0]!; } return timelineItem.block; }