fix: 本地文件夹 md 解析/预览修复与转写来源、引导去重等收尾 - #269
Merged
Merged
Conversation
- 页签顺序改为 概览→待办→动态→资料;概览独占态顶部加回页签行(可直达三页签) - 动态承接原概览时间轴卡全部能力(日/周/月+今天+类型/人物筛选+同期折叠),删极简 feed;OverviewTimelineCard 退役 - 待办三段纵排:日历/邮件/任务;新邮件分区合并连接器与本地邮件,同主题同日去重保连接器版 - 邮件详情双宿主:待办邮件区与资料面板都可打开(detailOwnerSubtabs 归属映射);ConnectorMailDetail 抽公共模块 - 测试:overview-timeline 改名 activity-timeline;新增 todo-mail-pane 4 用例
local-folder 来源从不往对象库落副本(导出直接读原路径),但解析器 和 Markdown 预览仍读对象库路径,导致文件夹内 md 必现 ENOENT "解析失败"。解析/预览对 local-folder 改为读原文件,启动时把 失败解析任务重置重试(上限 5 次),高风险批次批准后立即入解析队列。
云端补下发来源后即使 revision 未变也重新物化,纠正旧的 iPhone 兜底数据。
已保存过偏好的不再弹;页面挂载补弹一次后其余未引导类型当场记账, 浏览器 mock 偏好改走 sessionStorage 以便验证。
21335464876
approved these changes
Sep 22, 2026
There was a problem hiding this comment.
审查结论
请求修改:新增的待办邮件区存在一个证据充分的运行时回归(React Hooks 规则违规,打开/关闭本地邮件详情即崩溃)。其余改动(local-folder 解析修复、apple_watch 修正、引导去重等)核对无误。
🔴 阻塞:MailPane 在条件分支中调用 Hook,打开/关闭本地邮件详情即崩溃
apps/desktop/src/renderer/src/components/context-room/ported/components/detail-panels/ActivityPanes.tsx:572 的本地邮件详情早退 return 位于 :587 的 useConnectorMailDetail(...) 之前:
if (detail?.kind === 'mail' && localMailObject && onCloseDetail) {
return ( /* ObjectDetailView */ ) // ← 提前返回
}
const connectorMailDetail = detail?.kind === 'connector-mail' ? detail : null
const mailDetailState = useConnectorMailDetail(room.id, connectorMailDetail?.sourceId ?? null) // ← 条件性 Hook失败路径(React 18.3,生产构建同样抛出):
- 待办页签下 MailPane 先以
detail = null渲染列表,useConnectorMailDetail(内部 useState + useRef×2 + useEffect×2)已计入 hook 队列; - 点击本地快照邮件行 →
onOpen→PortedDetail.openObject→setSelectedObject({kind:'mail', id}),detail变为{kind:'mail'}; - 重渲染在 572 行提前返回,
useConnectorMailDetail未执行 → React 抛 "Rendered fewer hooks than during the previous render",面板崩溃(无错误边界时整树卸载)。关闭详情(detail → null)反向触发 "Rendered more hooks",同样崩溃。
对照:同 PR 从 MaterialsPane 抽取的公共模块顺序是正确的(MaterialsPane.tsx:294 的 hook 位于 :301 早退之前)。修复只需把 useConnectorMailDetail 上移到本地邮件早退之前;建议顺手给 context-room-todo-mail-pane.test.tsx 补一个「列表 → 打开本地邮件 → 关闭」的状态转换用例——现有用例只在挂载时固定 detail,拦不住这类问题。
🟡 次要(不阻塞)
apps/desktop/vite.browser.config.mts:431—getFilterRules改读sessionStorage.mockFilterPref,但updateFilterPreference没有回写该键;浏览器 demo 里保存偏好后「已有偏好不再弹引导」的路径实际无法生效,也无法验证。ActivityPane.tsx中clustered的useMemo依赖visibleEntries——它是每次渲染新建的数组,memo 实际每次重算;无功能影响,在意的话可把过滤+排序一并收进 useMemo。
✅ 核对无误的部分
- local-folder 解析/预览改读原路径:
resolveLocalPath有目录包含检查(local-folder-connector.ts:128-133,无路径逃逸风险);previewFile/parseJob对 ENOENT 给出友好文案;attempt_count在parseJob启动时自增(evidence-service.ts:357),重启重试上限 5 次逻辑自洽;新回归测试覆盖解析读原路径、对象库为空、预览、失败重启重试。 insertVersion去掉!shouldExport门槛是安全的:非 local-folder 扫描路径都会先storeObject(local-data-service.ts:1144/1172),local-folder 走原路径,不存在「对象未落库就解析」的窗口;高风险批次批准后立即入解析队列的路径同样成立。apple_watch修正:与RealityCaptureDeviceKind(packages/reality-contract/src/index.ts:18)、gateway 路由 schema、RealityPage.tsx:72图标映射一致;旧'watch'永不匹配导致真实手表数据被 iPhone 兜底覆盖,修正方向正确;fingerprint 纳入 captureDevice 后云端补发来源可触发重新物化。- 清理干净:
OverviewTimelineCard删除后无残留引用(组件/CSS 类名/测试名);i18n 中英文新键齐全;SourcesPage引导去重的同步 ref 守卫无竞态,存量补弹「至多一个 + 其余当场记账」符合 #232 意图。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test plan
tests/local-folder-evidence-parse.test.ts覆盖解析读原路径、对象库为空、预览、失败重试tests/private-transcription-sync.test.ts等合并后 18 条相关用例通过,tsc 干净