diff --git a/apps/web/tests/question-composer.e2e.ts b/apps/web/tests/question-composer.e2e.ts index 429465cb6c..4dff77b911 100644 --- a/apps/web/tests/question-composer.e2e.ts +++ b/apps/web/tests/question-composer.e2e.ts @@ -200,7 +200,7 @@ describe('web e2e: resident question composer round trip', () => { // Session-scoped store to restore both option and free-text drafts. const originalRow = page.locator('[role="treeitem"]') .filter({ hasText: 'Use the ask_user_question tool' }).first() - await page.getByRole('button', { name: /^(?:New session|新.*会话)$/ }).last().click() + await page.getByRole('button', { name: 'New session', exact: true }).last().click() await page.getByText('New Session', { exact: true }).waitFor({ timeout: 15_000 }) await expect.poll(() => composer.count(), { timeout: 10_000 }).toBe(0) await originalRow.click() diff --git a/packages/client/ui-user-questions/src/client/QuestionComposer.tsx b/packages/client/ui-user-questions/src/client/QuestionComposer.tsx index 561915952c..2f8726f3f0 100644 --- a/packages/client/ui-user-questions/src/client/QuestionComposer.tsx +++ b/packages/client/ui-user-questions/src/client/QuestionComposer.tsx @@ -168,7 +168,6 @@ function QuestionFlow({ pending, t, useStore, actions }: QuestionFlowProps) { const cancelFlow = (): void => { setBusy('cancel') setError(null) - replaceProgress(index, drafts) void pending.cancel() .then(() => { actions.clear(pending.key) }) .catch((cause: unknown) => { diff --git a/packages/client/ui-user-questions/tests/browser-plugin.client.spec.ts b/packages/client/ui-user-questions/tests/browser-plugin.client.spec.ts index 822484bf9b..cbe341902f 100644 --- a/packages/client/ui-user-questions/tests/browser-plugin.client.spec.ts +++ b/packages/client/ui-user-questions/tests/browser-plugin.client.spec.ts @@ -6,6 +6,7 @@ import { LocaleRuntime } from '@deepseek-ai/dsh-client-locale/client' import type { SessionId } from '@deepseek-ai/dsh-session/types' import { QuestionComposer } from '../src/client/QuestionComposer.tsx' import { PendingQuestion } from '../src/client/contract/slots.ts' +import { createQuestionDraftStore } from '../src/client/draft-store.ts' import { apply, inject } from '../src/client/index.ts' const SESSION_ID = 'session-question' as SessionId @@ -122,7 +123,10 @@ describe('apply', () => { expect(entry.component).toBe(QuestionComposer) expect(entry.inject).toBeUndefined() expect(entry.locale).toBe('question') - expect(entry.store).toBeDefined() + const store = entry.store as ReturnType + expect(store.create(SESSION_ID).getSnapshot()).toEqual({ + progress: { index: 0, drafts: [] }, + }) const pending = b.pending.getSnapshot()[0]! const select = entry.select as ( owner: { pendingInteraction: PendingQuestion | undefined }, diff --git a/packages/client/ui-user-questions/tsconfig.json b/packages/client/ui-user-questions/tsconfig.json index e9d731d713..5a4fc42f8b 100644 --- a/packages/client/ui-user-questions/tsconfig.json +++ b/packages/client/ui-user-questions/tsconfig.json @@ -29,6 +29,9 @@ { "path": "../locale" }, + { + "path": "../store" + }, { "path": "../ui-conversation" },