Skip to content

Commit

Permalink
Use API order instead of reordering timeline (#1503)
Browse files Browse the repository at this point in the history
  • Loading branch information
wintonzheng authored Jan 6, 2025
1 parent 45cfa58 commit 2e9bcc3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -98,8 +96,10 @@ function WorkflowRunTimeline({
</div>
</div>
)}
{timeline.length === 0 && <div>Workflow timeline is empty</div>}
{timeline?.map((timelineItem) => {
{workflowRunTimeline.length === 0 && (
<div>Workflow timeline is empty</div>
)}
{workflowRunTimeline?.map((timelineItem) => {
if (isBlockItem(timelineItem)) {
return (
<WorkflowRunTimelineBlockItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function WorkflowRunTimelineBlockItem({
onBlockItemClick,
onActionClick,
}: Props) {
const actions = block.actions ? [...block.actions].reverse() : [];
const actions = block.actions ?? [];

const hasActiveAction =
isAction(activeItem) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ function findActiveItem(
return "stream";
}
if (timeline?.length > 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;
}
Expand Down

0 comments on commit 2e9bcc3

Please sign in to comment.