Phase A — EditorRuntimeActor 内存缓存层 - 新增 editor_actor.rs: EditorBlockDocument 内存态 + apply_command + load_or_init - block.rs 四个写工具(replace/insert/delete/move)接入 actor 路径 - editor_actor feature flag(MNOTE_WEB_ENABLE_EDITOR_ACTOR=true 默认开启) - bridge-runtime 三个核心函数公开化 - rust-toolchain: 1.89 → stable(修复 spike WASM 编译阻塞) Phase B — 编辑器增量 delta channel - BlockDelta/DeltaOperation 类型 + actor.build_block_delta() - leptos-tiptap spike: mnote:editor:block-delta CustomEvent 监听 + JSON patch - DocumentAiAgentPanel: 拦截 blockDelta → window dispatchEvent - 工具响应含 blockDelta 字段供前端消费 Phase C — 事件 stream delta - broadcast channel 在 AppState/actor/SSE 三层贯通 - tree_events SSE 端点发 block.delta 事件 - 旧客户端降级兼容 环境修复 - rustc recursion_limit = 1024(修复 Leptos SSR 类型深度溢出) - run-convex-deploy.js(封装 Convex function 部署到本地后端 3210) ref: design/07-ai/process/7-13-page-block-editor-runtime-actor-v1.md
96 lines
3.4 KiB
Markdown
96 lines
3.4 KiB
Markdown
# 5-13 [done][bug] Tree rename live 后当前文档页 chrome 未同步 v1
|
||
|
||
> 更新时间:2026-05-16
|
||
>
|
||
> 分类归属:
|
||
> - `05-editor-mainline/done`
|
||
> - 关联边界:`Rust Web document shell / Tree Realtime Live Cache / Page title chrome`
|
||
|
||
## 1. 问题定义
|
||
|
||
双浏览器 rename live cache 验收中,A 端通过正式 `/api/tree/commands` 执行 `tree.node.rename` 后,B 端已经收到 `/api/tree/events` 的 `tree:delta upsert_document`。
|
||
|
||
修复前 B 端 Sidebar / Page Tree 与 File Tree 行标题会更新,但当前打开目标文档页的页头标题输入框、Breadcrumb 和 `document.title` 仍停留旧标题。
|
||
|
||
## 2. 复现步骤
|
||
|
||
1. 启动 `http://127.0.0.1:3000`。
|
||
2. 运行双浏览器 smoke:
|
||
|
||
```bash
|
||
MNOTE_UI_BASE_URL=http://127.0.0.1:3000 MNOTE_AUTH_BASE_URL=http://127.0.0.1:3000 node scripts/task446-tree-rename-dual-browser-live-smoke.js
|
||
```
|
||
|
||
3. A 端创建 root / target 页面并执行 `{ action: "rename", workspaceId, documentId, title }`。
|
||
4. B 端保持目标文档页和 File Tree 页面不刷新,等待 live update。
|
||
|
||
## 3. 实际表现
|
||
|
||
RED 证据中 B 端状态为:
|
||
|
||
- `liveApplied=delta`
|
||
- `liveError=""`
|
||
- `treeEvents[1].op=upsert_document`
|
||
- `sidebarTitle={renamedTitle}`
|
||
- `fileTreeTitle={renamedTitle}.md`
|
||
- `titleInputValue` 仍为旧标题
|
||
- `breadcrumbTitle` 仍为旧标题
|
||
- `documentTitle` 仍为旧标题
|
||
|
||
证据路径:
|
||
|
||
- `tmp/tree-live-cache-smoke/20260516-task446-rename/result.json`
|
||
|
||
## 4. 根因
|
||
|
||
`rust/crates/mnote-web/src/ssr/pages/layout.rs` 中 Rust SSR tree live controller 在处理 title-only `upsert_document` 时调用 `updateTitleEverywhere(documentId, title)`。
|
||
|
||
该函数原先只更新 Page Tree / File Tree 行标题,没有同步当前打开文档页的 chrome:
|
||
|
||
- `[data-page-title-input="true"][data-document-id="<id>"]`
|
||
- `.wolai-breadcrumb-current [data-page-title-current]`
|
||
- `document.title`
|
||
|
||
因此 tree realtime delta 已到达,树行也已更新,但文档页头仍保留旧快照。
|
||
|
||
## 5. 修复
|
||
|
||
`rust/crates/mnote-web/src/ssr/pages/layout.rs` 的 `updateTitleEverywhere(documentId, title)` 增加当前文档 chrome 同步:
|
||
|
||
- 当前文档的 title input 更新为新标题,并同步 `data-title-last-saved` / `data-title-save-status`。
|
||
- 当前 document pane 内的 `[data-page-title-current="true"]` 更新为新标题。
|
||
- 当前 URL 对应文档时,更新 `document.title` 与 topbar Breadcrumb。
|
||
|
||
同时补充字符串合同单测,确保当前页 title input 与 Breadcrumb selector 留在 SSR tree live controller 中。
|
||
|
||
## 6. 验证
|
||
|
||
配套单测:
|
||
|
||
```bash
|
||
cargo test --manifest-path rust/Cargo.toml -p mnote-web sidebar_tree_runtime_renders_context_menu_and_scoped_title_updates -- --nocapture
|
||
```
|
||
|
||
结果:`1 passed`。
|
||
|
||
真实 3000 smoke:
|
||
|
||
```bash
|
||
MNOTE_UI_BASE_URL=http://127.0.0.1:3000 MNOTE_AUTH_BASE_URL=http://127.0.0.1:3000 node scripts/task446-tree-rename-dual-browser-live-smoke.js
|
||
```
|
||
|
||
结果:通过。
|
||
|
||
证据:
|
||
|
||
- `tmp/tree-live-cache-smoke/20260516-task446-rename/result.json`
|
||
- `tmp/tree-live-cache-smoke/20260516-task446-rename/b-document-after-rename.png`
|
||
- `tmp/tree-live-cache-smoke/20260516-task446-rename/b-filetree-after-rename.png`
|
||
|
||
验证结果:
|
||
|
||
- B 文档页 `documentTitle/titleInputValue/breadcrumbTitle/sidebarTitle` 均为新裸标题。
|
||
- B File Tree `fileTreeTitle={renamedTitle}.md`。
|
||
- B 端 `liveApplied=delta`、`liveError=""`。
|
||
- rename 后 `navigationEvents=[]`,没有刷新或导航。
|