Files
mnote/bugs/05-editor-mainline/process/5-18-ai-write-body-does-not-sync-page-aggregate-content-v1.md
T

34 lines
1.6 KiB
Markdown
Raw Normal View History

# 5-18 [process][bug] AI 写正文后本地 Page Aggregate content 可能不刷新 v1
> 发现时间:2026-05-17
>
> 状态:`[process]`
>
> 关联主线:`05-editor-mainline`
## 1. 问题定义
页面 AI 写正文后,前端本地 Page Aggregate state 只更新 persisted meta,不保证同步正文快照。`editorBridge.replaceWithSnapshot` 在 editor host 内派发 runtime command,但没有直接回写 reducer content。
## 2. 证据
- [DocumentAiAgentPanel.runtime.tsx](/mnt/Data1T/mnote/wolai-frontend/src/components/editor/DocumentAiAgentPanel.runtime.tsx:913) 附近处理 AI 写入后的前端状态。
- [document-content.tsx](/mnt/Data1T/mnote/wolai-frontend/src/components/editor/document-content.tsx:876) 附近接收 AI 结果。
- [leptos-tiptap-island-editor-host.tsx](/mnt/Data1T/mnote/wolai-frontend/src/components/editor/leptos-tiptap-island-editor-host.tsx:772) `replaceWithSnapshot` 只通过 editor runtime command 更新 host。
## 3. 影响
- 用户连续两次问 AI 时,第二次 AI context 可能仍读旧 `pageClientState.content`
- 编辑器显示与 Page Aggregate reducer 状态不一致。
- AI 写入验收如果只看编辑器 DOM,可能漏掉 context stale 问题。
## 4. 建议修复
- AI 写入成功后应触发 Page Aggregate 回读或统一 reducer content 更新。
- AI context 应从最新 Rust Page Aggregate snapshot 读取,而不是依赖可能过期的本地 reducer。
- 增加 smoke:AI 修改正文后不刷新页面连续再问一次 AI,断言第二次 context 包含新内容。
## 5. 状态
已确认 AI 写入后本地 Page Aggregate content 可能滞后,尚未修复。