Skip to content

ui: 投资逻辑面板在已有研究报告时仍显示「尚无研究报告」,且该提示在无报告时重复出现两次 #256

Description

@wxrbyte

现象

投资逻辑(Thesis)面板在已经存在研究报告时,标题下方仍然断言「尚无研究报告」;而在没有报告时,同一句提示会重复渲染两次。

packages/ui/src/components/thesis/ThesisPanel.tsx 的三处相关渲染:

  • 第 184 行(ae526acb,2026-08-28「Stitch portfolio design refresh」引入)在 folio-thesis-header 内无条件渲染 thesis.noReportFor;
  • 第 198–202 行(86191798,2026-08-14 起)渲染同一句文案,且正确地受 !report 门控,以虚线提示条形式展示;
  • 第 186–195 行的「存为投资逻辑」按钮同样受 report 门控。

于是:

  • report != null 时,同一个 header 区域同时呈现「尚无研究报告」与「存为投资逻辑」两个互相矛盾的 UI 状态;
  • report == null 时,同一句话上下相隔十几行出现两次。

复现

在 packages/ui 下新增 src/components/thesis/ThesisPanel.test.tsx,用 happy-dom + jotai store + 桩 window.electronAPI.thesis.getReport 渲染面板,分别注入「有报告」与「无报告」两种状态:

(fail) never claims a report is missing once one exists
  Expected: 0
  Received: 1          # 报告存在(“Save as Thesis” 按钮断言已通过),标题下仍出现 1 次「尚无研究报告」
(fail) shows the no-report prompt exactly once when there is no report
  Expected: 1
  Received: 2          # 无报告时同一句文案出现 2 次
 0 pass / 2 fail

根因

ae526acb 的批量设计刷新给各工作台页面统一加了 folio-eyebrow + folio-*-title + folio-*-subtitle 三段式头部(对照页 CompareWorkspace 的 folio-compare-subtitle 用的是静态描述 compare.agentContext)。这次改动在 ThesisPanel 里把 thesis.noReportFor 这个状态文案塞进了与状态无关的副标题槽位,却没有同步补上 !report 门控。

本仓库既定的状态提示载体是 border-dashed 提示条 —— AlertList、AutomationRulesView、CompareWorkspace、ThesisImpactList,以及本文件第 207 行的 noneSaved 空状态都是这一模式。ThesisPanel 第 199 行的提示条同样如此,因此状态文案本就该只出现在那里。

影响

  • 误导用户:深度研究已经跑完(「存为投资逻辑」按钮可见可点)时,页面顶部仍告诉用户「尚无研究报告」,会促使用户重复发起研究;
  • 视觉冗余:无报告时同一句 CTA 重复两次;
  • 中英双语 locale 均受影响(thesis.noReportFor 在 zh-CN / en-US 两个 bundle 均有值)。

修复方案

删除第 184 行这条无条件副标题,状态文案只保留在第 198–202 行受 !report 门控的提示条中;同时把随之失去引用的 .folio-thesis-subtitle 从 CSS 选择器列表中摘除(该规则与 .folio-compare-subtitle 共用,只需摘除类名,不影响对照页样式)。

不新增 i18n key,也不改动任何文案措辞 —— 避免替他人在两个 locale 里做新增用户可见文案的产品决策。

已考虑但未采用的替代方案:给「有报告」状态新增一条静态副标题文案(如 thesis.reportReady)。这需要新增两条用户可见文案,属于产品措辞决策;且无报告时仍会与下方提示条重复,并未消除冗余。

验证

修复后:

(pass) never claims a report is missing once one exists
(pass) shows the no-report prompt exactly once when there is no report
 2 pass / 0 fail

回归对照:

命令 修复前 修复后
bun test packages/ui --isolate 321 pass / 0 fail 323 pass / 0 fail(+2 为本轮新增用例)
bun test apps/electron --isolate 32 pass / 0 fail 32 pass / 0 fail
bun run typecheck 5/5 exit 0 5/5 exit 0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

claimedClaimed by a contributor and currently in progress

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions