From f445533cfde48ff62a761c2b0aef146c563c107e Mon Sep 17 00:00:00 2001 From: gaoming <2168502171@qq.com> Date: Wed, 12 Aug 2026 17:48:24 +0800 Subject: [PATCH] fix: reset run-scoped UI state on selection changes --- web/src/App.test.tsx | 106 ++++++++++++++++++++++++++++++++++++++++--- web/src/App.tsx | 6 ++- 2 files changed, 104 insertions(+), 8 deletions(-) diff --git a/web/src/App.test.tsx b/web/src/App.test.tsx index 95723fb4..134579e2 100644 --- a/web/src/App.test.tsx +++ b/web/src/App.test.tsx @@ -1,8 +1,12 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { fireEvent, render, screen } from "@testing-library/react"; +import { act, fireEvent, render, screen } from "@testing-library/react"; +import { useState } from "react"; import App from "./App"; import { useConnectionStore } from "./state/connection"; +const submitRunDraft = vi.hoisted(() => vi.fn()); +const submitSessionDraft = vi.hoisted(() => vi.fn()); + vi.mock("./lib/locale", () => ({ useLocale: () => ({ locale: "zh-CN", setLocale: () => undefined, t: (chinese: string) => chinese }), @@ -10,12 +14,47 @@ vi.mock("./lib/locale", () => ({ vi.mock("./components/resource-sidebar", () => ({ ResourceSidebar: () => null })); vi.mock("./components/run-workspace", () => ({ - RunWorkspace: ({ client }: { client: { hasVerificationEvidence: boolean } }) => -
- {String(client.hasVerificationEvidence)} -
, + RunWorkspace: ({ client, runID }: { + client: { hasVerificationEvidence: boolean }; + runID: string; + }) => { + const [draft, setDraft] = useState(""); + const [operationState, setOperationState] = useState("idle"); + return
+
+ {String(client.hasVerificationEvidence)} +
+
{runID}
+
{operationState}
+