fix: use matching state in status list (#18349)

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.
This commit is contained in:
Asher
2025-06-13 12:15:56 -08:00
committed by GitHub
parent dc5f69ebfe
commit 5bcde58bdc
2 changed files with 33 additions and 1 deletions
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";
import { userEvent, within } from "@storybook/test";
import type { WorkspaceAppStatus } from "api/typesGenerated";
import {
MockWorkspace,
@@ -82,6 +83,37 @@ export const SingleStatus: Story = {
},
};
export const MultipleStatuses: Story = {
args: {
agent: mockAgent([
{
...MockWorkspaceAppStatus,
id: "status-1",
icon: "",
message: "Initial setup complete.",
created_at: createTimestamp(5, 10), // 15:05:10 (after referenceDate)
uri: "",
state: "complete" as const,
},
{
...MockWorkspaceAppStatus,
id: "status-2",
icon: "",
message: "Working...",
created_at: createTimestamp(5, 0), // 15:05:00 (after referenceDate)
uri: "",
state: "working" as const,
},
]),
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const submitButton = canvas.getByRole("button");
await userEvent.click(submitButton);
await canvas.findByText(/working/i);
},
};
function mockAgent(statuses: WorkspaceAppStatus[]) {
return {
...MockWorkspaceAgent,
+1 -1
View File
@@ -156,7 +156,7 @@ export const AppStatuses: FC<AppStatusesProps> = ({
<div className="flex items-center justify-between w-full text-content-secondary">
<span className="text-xs flex items-center gap-2">
<AppStatusStateIcon
state={latestStatus.state}
state={status.state}
latest={false}
className="size-icon-xs w-[18px]"
/>