Skip to content

Commit f32acee

Browse files
committed
fix: use current state in status list
It was using the latest state for all statuses, so if the last status was "failing" for example every status would show the failing icon.
1 parent f1cca03 commit f32acee

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

site/src/pages/WorkspacePage/AppStatuses.stories.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2+
import { userEvent, within } from "@storybook/test";
23
import type { WorkspaceAppStatus } from "api/typesGenerated";
34
import {
45
MockWorkspace,
@@ -82,6 +83,37 @@ export const SingleStatus: Story = {
8283
},
8384
};
8485

86+
export const MultipleStatuses: Story = {
87+
args: {
88+
agent: mockAgent([
89+
{
90+
...MockWorkspaceAppStatus,
91+
id: "status-1",
92+
icon: "",
93+
message: "Initial setup complete.",
94+
created_at: createTimestamp(5, 10), // 15:05:10 (after referenceDate)
95+
uri: "",
96+
state: "complete" as const,
97+
},
98+
{
99+
...MockWorkspaceAppStatus,
100+
id: "status-2",
101+
icon: "",
102+
message: "Working...",
103+
created_at: createTimestamp(5, 0), // 15:05:00 (after referenceDate)
104+
uri: "",
105+
state: "working" as const,
106+
},
107+
]),
108+
},
109+
play: async ({ canvasElement }) => {
110+
const canvas = within(canvasElement);
111+
const submitButton = canvas.getByRole("button");
112+
await userEvent.click(submitButton);
113+
await canvas.findByText(/working/i);
114+
},
115+
};
116+
85117
function mockAgent(statuses: WorkspaceAppStatus[]) {
86118
return {
87119
...MockWorkspaceAgent,

site/src/pages/WorkspacePage/AppStatuses.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export const AppStatuses: FC<AppStatusesProps> = ({
156156
<div className="flex items-center justify-between w-full text-content-secondary">
157157
<span className="text-xs flex items-center gap-2">
158158
<AppStatusStateIcon
159-
state={latestStatus.state}
159+
state={status.state}
160160
latest={false}
161161
className="size-icon-xs w-[18px]"
162162
/>

0 commit comments

Comments
 (0)