Переглянути джерело

fix(web): address question draft review feedback

Yichen Jiang 3 тижнів тому
батько
коміт
605e33a2f5

+ 1 - 1
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()

+ 0 - 1
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) => {

+ 5 - 1
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<typeof createQuestionDraftStore>
+    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 },

+ 3 - 0
packages/client/ui-user-questions/tsconfig.json

@@ -29,6 +29,9 @@
     {
       "path": "../locale"
     },
+    {
+      "path": "../store"
+    },
     {
       "path": "../ui-conversation"
     },