fix(tree): stabilize filetree mindmap switching
Open filetree mindmap assets inside the primary document pane so the sidebar root is not rebuilt during rapid mindmap/page switching. Keep filetree active rows on doc:<documentId> and asset:<mindmapId>, shorten generated mindmap filenames, and preserve legacy index rows only as compatibility input. Add task438-task445 browser smokes and close the 4-27/4-38/4-39/4-40 tree-domain bug records.
This commit is contained in:
@@ -0,0 +1,147 @@
|
||||
# 4-27 [done][bug] File Tree 打开对象后 active / reveal 跳动 v1
|
||||
|
||||
> 更新时间:2026-05-16
|
||||
>
|
||||
> 分类归属:
|
||||
> - `04-tree-domain/done`
|
||||
> - 涉及边界:`05-editor-mainline/object editor active identity`、`file_tree row selection/focus/reveal`
|
||||
>
|
||||
> 用户反馈:
|
||||
> - “目前文件树中思维导图点击后文件树会闪一下,然后跳到对应的 index。”
|
||||
> - “文件树中,点击页面下方(滚动条到下部分)的页面,有时候会跳一下,然后就看不到点的那个文件里。”
|
||||
|
||||
## 1. 问题定义
|
||||
|
||||
File Tree 中点击某个对象后,树 UI 会发生短暂闪烁或滚动跳动,最终 active / reveal 位置可能落到同页面的 `index.md`,或者滚动到别处导致刚点击的文件不可见。
|
||||
|
||||
这类问题不是简单的路由跳转慢,而是 `file_tree row click -> object open intent -> active object identity -> selection/focus/reveal -> virtual/DOM tree render` 链路不一致。尤其是 mindmap asset 点击后如果页面 active identity 被降级成 document/index identity,就会把用户刚点击的 asset 行“纠正”为同页面 `index.md` 行,表现为文件树闪一下并跳到 index。
|
||||
|
||||
## 2. 初步判断
|
||||
|
||||
当前不应直接把它当成 `5-10 mindmap 污染 index.md` 的重复问题。`5-10` 已经关闭的是“mindmap 打开/保存污染正文真源”;本问题关注的是打开动作之后 File Tree 的 active row 和 scroll reveal 是否稳定。
|
||||
|
||||
更可能存在三类根因:
|
||||
|
||||
1. `tree.asset.open` 打开 mindmap 后,主编辑区 active state 只回传 `documentId`,没有保留 `objectIdentity=resource:mindmap:{documentId}:{assetId}`,导致 File Tree active row 映射回 `index:{documentId}`。
|
||||
2. 点击文件树下半部分页面时,导航成功、sidebar snapshot 校准、tree live delta/resync 或本地 projection rebuild 触发了 reveal 当前文档逻辑,未区分“用户刚点击的 row”与“路由推导出的默认 index row”。
|
||||
3. File Tree 在大列表滚动区域内重新渲染时,expanded/selected/focused/active/reveal 状态没有按 rowId 稳定合并,导致 scroll anchor 丢失,用户看到跳动后目标行被滚出视口。
|
||||
|
||||
## 3. 与既有 done bug 的关系
|
||||
|
||||
关联但不重复:
|
||||
|
||||
- `bugs/05-editor-mainline/done/5-10-mindmap-filetree-index-single-truth-split-v1.md`:关闭 mindmap object 与 `index.md` 正文真源混淆。
|
||||
- `bugs/04-tree-domain/done/4-26-sidebar-filetree-projection-refresh-stalled-after-tree-asset-mutations-v1.md`:关闭新建/删除/新建 mindmap 后 File Tree 不刷新的问题。
|
||||
|
||||
本 bug 的新增点是:对象已经可见、也能打开,但打开后的 active/reveal/scroll 行为仍不稳定。
|
||||
|
||||
## 4. 建议复现路径
|
||||
|
||||
1. 登录真实测试账号,进入 `http://localhost:3000/` 或主文档页。
|
||||
2. 新建测试页面 `TEST-FILETREE-REVEAL-<timestamp>`,在页面内新建一个 mindmap。
|
||||
3. 在 File Tree 中滚动到该页面及其 mindmap asset 行。
|
||||
4. 点击 mindmap asset 行。
|
||||
5. 记录点击前 rowId、点击后 active rowId、scrollTop、URL、主编辑区 object identity。
|
||||
6. 期望:active row 应保持在 mindmap asset 或明确的 object tab row,不应自动跳到 `index:{documentId}`。
|
||||
7. 在长列表中滚动到下半部分,点击一个页面或其 `index.md`。
|
||||
8. 期望:导航后目标 row 仍在视口内,不能被 reveal 到其它位置后消失。
|
||||
|
||||
## 5. 验收标准
|
||||
|
||||
- 点击 File Tree 的 mindmap asset 后,不刷新浏览器,不发生无解释的整树闪烁。
|
||||
- 点击 mindmap asset 后,File Tree active / selected / focused row 不得被降级成同页面 `index.md`,除非产品明确决定普通点击只打开 index;如果这样决定,UI 必须不展示为 asset 被打开。
|
||||
- 点击长列表下半部分页面或 `index.md` 后,目标 row 在导航完成和 projection 校准后仍保持可见。
|
||||
- `reveal` 逻辑必须区分用户点击产生的 explicit focus 与路由/文档 active 推导的 implicit reveal,不能让 implicit reveal 覆盖刚发生的 explicit focus。
|
||||
- 增加真实浏览器 smoke,至少记录:点击前后 rowId、active object identity、scrollTop 变化、是否发生 navigation/reload、最终目标 row 是否在 viewport 内。
|
||||
|
||||
## 6. 建议修复方向
|
||||
|
||||
先补 smoke 复现,不要直接改实现。修复时优先沿以下边界排查:
|
||||
|
||||
1. File Tree row click 发出的 `tree.asset.open` 是否携带完整 `objectIdentity`。
|
||||
2. 主编辑区打开 mindmap object editor 后是否把 active identity 回传给 Sidebar / File Tree。
|
||||
3. `index:{documentId}` 的 active 高亮是否只在打开 page/index 时生效,而不是覆盖 asset object。
|
||||
4. 本地 projection rebuild 后是否按 rowId 恢复 expanded/selected/focused/reveal,不按 documentId 粗粒度重置。
|
||||
5. scroll reveal 是否只在目标 row 不在 viewport 内时执行,并避免重复 reveal。
|
||||
|
||||
## 7. 当前状态
|
||||
|
||||
当前状态:`done`
|
||||
|
||||
2026-05-15 已随 `4-35` P0/P1 完成第一层止血:
|
||||
|
||||
- Convex File Tree 页面正文 row 不再显示为页面容器下的 `index.md`,而是直接显示为 `新页面.md` 这类 markdown row。
|
||||
- 主文档壳本地 create apply 不再手工插入 `index:<documentId>` 行。
|
||||
- 当前文档的 File Tree selected / focused 默认从 `index:<documentId>` 改为 `doc:<documentId>`。
|
||||
- 新增真实浏览器 smoke:`scripts/task438-filetree-title-md-active-reveal-smoke.js`,覆盖新建页面后没有 `index.md` 行、页面正文 row 显示 `.md`、点击长列表中的页面 row 后 selected 留在 `doc:<id>`,且目标 row 仍在视口内。
|
||||
- P2 继续补齐 File Tree inline rename:输入 `{title}.md` 时只把 `{title}` 作为页面标题提交,File Tree 仍显示 `{title}.md`;非法字符和同级重名会在输入框内提示,不触发 rename command。
|
||||
|
||||
已通过:
|
||||
|
||||
```bash
|
||||
MNOTE_UI_BASE_URL=http://127.0.0.1:3428 node scripts/task438-filetree-title-md-active-reveal-smoke.js
|
||||
MNOTE_UI_BASE_URL=http://127.0.0.1:3428 node scripts/task439-filetree-title-md-rename-smoke.js
|
||||
MNOTE_UI_BASE_URL=http://127.0.0.1:3428 node scripts/task440-page-title-filetree-md-sync-smoke.js
|
||||
```
|
||||
|
||||
结果文件:`tmp/task438-filetree-title-md-active-reveal-smoke/result.json`。
|
||||
补充结果文件:`tmp/task439-filetree-title-md-rename-smoke/result.json`。
|
||||
标题栏同步结果文件:`tmp/task440-page-title-filetree-md-sync-smoke/result.json`。
|
||||
|
||||
关键结果:
|
||||
|
||||
- `ok=true`
|
||||
- `beforeClick.indexRowExists=false`
|
||||
- `beforeClick.rowTitle="新页面.md"`
|
||||
- `afterClick.selectedRows=[{"rowId":"doc:<documentId>", ...}]`
|
||||
- `afterClick.visible=true`
|
||||
- `task439.afterRename.fileTreeTitle="<title>.md"`
|
||||
- `task439.afterRename.pageTreeTitle="<title>"`
|
||||
- `task439.invalidState.validationText="文件名不能包含 / \\ : * ? \" < > |"`
|
||||
- `task439.duplicateState.validationText="同级已存在同名页面"`
|
||||
- `task440.after.fileTreeTitle="<title>.md"`
|
||||
- `task440.after.pageTreeTitle="<title>"`
|
||||
- `task440.after.indexRowExists=false`
|
||||
|
||||
2026-05-15 P3 口径补充:
|
||||
|
||||
- 后续 File Tree active / reveal 修复不再以可见 `index.md` 行为目标;Convex 页面正文默认 row 是 `doc:<documentId>`,显示标题为 `{title}.md`。
|
||||
- `rowKind=index` 只作为历史 projection / command 兼容输入保留,不能重新作为默认 UI 可见行引入。
|
||||
|
||||
2026-05-15 P4 子问题关闭:
|
||||
|
||||
- mindmap asset 点击后 active / selected 从 `asset:{mindmapId}` 闪回父页面 `doc:{documentId}` 的子问题已单独关闭,记录见 `bugs/04-tree-domain/done/4-38-filetree-mindmap-click-active-row-flicker-v1.md`。
|
||||
- 修复点:`/mindmap/{documentId}/{mindmapId}` 对象页的 SSR filetree active row 改为 `asset:{mindmapId}`;客户端 tree live snapshot renderer 也按 `/mindmap` 路由恢复 `asset:{mindmapId}`,不再只按 `doc:{documentId}` 选中。
|
||||
- 真实浏览器 smoke:`MNOTE_UI_BASE_URL=http://127.0.0.1:3428 node scripts/task443-filetree-mindmap-click-active-row-smoke.js`,结果文件 `tmp/task443-filetree-mindmap-click-active-row-smoke/result.json`。
|
||||
|
||||
2026-05-16 当前口径关闭:
|
||||
|
||||
- mindmap asset 连续点击和其它页面切换时,不再通过整页 `/mindmap/...` 导航重建 sidebar;主文档壳新增 `openPrimaryMindmap()`,在当前 primary pane 内挂载 mindmap 对象,并保持 `#sidebar-file-tree-root` DOM 根节点稳定。
|
||||
- mindmap asset 选中语义保持为 `asset:{mindmapId}`,不会回落到父页面 `doc:{documentId}` 或历史 `index:{documentId}`。
|
||||
- Convex 页面正文默认 row 继续保持 `doc:{documentId}`,显示为 `{title}.md`;历史 `index` 只作为兼容输入,不再作为默认 UI active / reveal 目标。
|
||||
- mindmap 文件名从 `mindmap-mindmap_...json` 这类技术名收敛为 `思维导图-xxxx.json`,避免连续切换时标题重绘造成观感跳动。
|
||||
- 关闭记录见:
|
||||
- `bugs/04-tree-domain/done/4-38-filetree-mindmap-click-active-row-flicker-v1.md`
|
||||
- `bugs/04-tree-domain/done/4-39-filetree-create-title-cache-md-conflict-v1.md`
|
||||
- `bugs/04-tree-domain/done/4-40-filetree-mindmap-switch-flicker-and-short-title-v1.md`
|
||||
|
||||
新增 / 复用真实浏览器 smoke:
|
||||
|
||||
```bash
|
||||
MNOTE_UI_BASE_URL=http://127.0.0.1:3428 node scripts/task443-filetree-mindmap-click-active-row-smoke.js
|
||||
MNOTE_UI_BASE_URL=http://127.0.0.1:3428 node scripts/task444-filetree-create-mindmap-title-cache-smoke.js
|
||||
MNOTE_UI_BASE_URL=http://127.0.0.1:3428 node scripts/task445-filetree-mindmap-switch-no-flicker-smoke.js
|
||||
```
|
||||
|
||||
`task445` 关键结果:
|
||||
|
||||
- `before.mindmapTitle = "思维导图-7712.json"`
|
||||
- `afterMindmap.fileRootStable = true`
|
||||
- `afterPage.fileRootStable = true`
|
||||
- `afterMindmapAgain.fileRootStable = true`
|
||||
- `failures = []`
|
||||
|
||||
后续如再次出现,应拆成独立新缺陷跟踪:
|
||||
|
||||
- 更长列表、搜索过滤、恢复后 reveal、双浏览器 resync 场景下是否仍稳定。
|
||||
- 明确复现的“点击文件树下半部分页面后跳一下导致看不到刚点击文件”的滚动锚点问题。
|
||||
@@ -0,0 +1,59 @@
|
||||
# 4-38 文件树 mindmap 点击后选中态闪回父页面
|
||||
|
||||
## 状态
|
||||
|
||||
- 状态:done
|
||||
- 分类:04-tree-domain
|
||||
- 发现时间:2026-05-15
|
||||
- 修复时间:2026-05-15
|
||||
|
||||
## 现象
|
||||
|
||||
点击页面树普通页面时视觉稳定;点击文件树中的思维导图资源行时,资源行会快速闪一下,随后文件树选中态回到父页面 `.md` 行。用户体感类似“点了 mindmap 文件,但文件树又跳回对应页面/index”。
|
||||
|
||||
## 根因
|
||||
|
||||
文件树资源点击路径先执行 `selectSidebarFileTreeRow()`,使 asset row 短暂 selected;随后 mindmap 资源通过 `tree.asset.open -> openConvexAssetFromFileTree()` 整页跳转到 `/mindmap/{documentId}/{mindmapId}`。
|
||||
|
||||
旧实现中 `/mindmap` 对象页重新渲染文件树时只按当前 `documentId` 计算选中态:
|
||||
|
||||
```text
|
||||
rowId === 'doc:' + activeId
|
||||
```
|
||||
|
||||
因此页面重建或 tree live snapshot 重绘后,选中态会从 `asset:{mindmapId}` 回落到 `doc:{documentId}`,形成快速闪烁。
|
||||
|
||||
## 修复
|
||||
|
||||
- `mindmap_object_shell` 加载文件树时传入 active row:`asset:{mindmapId}`。
|
||||
- `collect_filetree_render_rows()` 新增 `active_row_id`,当存在 active row 时优先按 row id 选中,避免父页面 fallback 抢回 selected。
|
||||
- `SIDEBAR_TREE_JS` 的 live snapshot renderer 新增 `currentFileTreeActiveRowId()`,在 `/mindmap/{doc}/{asset}` 路径下保持 `asset:{asset}` 选中,防止 SSE 重绘后再次闪回。
|
||||
|
||||
## 验证
|
||||
|
||||
Rust 定向测试:
|
||||
|
||||
```bash
|
||||
cargo test --manifest-path rust/Cargo.toml -p mnote-web sidebar_filetree_runtime_uses_markdown_page_row_without_local_index_child -- --nocapture
|
||||
cargo test --manifest-path rust/Cargo.toml -p mnote-web mindmap_shell_returns_rust_object_shell_contract -- --nocapture
|
||||
cargo test --manifest-path rust/Cargo.toml -p mnote-web filetree_rows_select_active_mindmap_asset_in_object_shell -- --nocapture
|
||||
```
|
||||
|
||||
真实浏览器 smoke:
|
||||
|
||||
```bash
|
||||
MNOTE_UI_BASE_URL=http://127.0.0.1:3428 node scripts/task443-filetree-mindmap-click-active-row-smoke.js
|
||||
```
|
||||
|
||||
验证结果:
|
||||
|
||||
- `tmp/task443-filetree-mindmap-click-active-row-smoke/result.json`
|
||||
- 截图:`tmp/task443-filetree-mindmap-click-active-row-smoke/after-mindmap-click.png`
|
||||
- 点击后 URL 为 `/mindmap/{documentId}/{mindmapId}`。
|
||||
- 点击前 selected row 为 `doc:{documentId}`。
|
||||
- 点击后 selected row 为 `asset:{mindmapId}`。
|
||||
- 点击后不再出现父页面 `doc:{documentId}` selected。
|
||||
|
||||
## 后续口径
|
||||
|
||||
mindmap、附件、table 等资源对象打开后,文件树 active/selected 不能只按父 `documentId` 回落到页面行;对象页或对象视图必须优先表达资源对象身份。页面正文才选中 `doc:{documentId}`。
|
||||
@@ -0,0 +1,116 @@
|
||||
# 4-39 文件树新建不更新与 `.md` 后缀被缓存/标题同步覆盖
|
||||
|
||||
## 状态
|
||||
|
||||
- 状态:done
|
||||
- 分类:04-tree-domain
|
||||
- 发现时间:2026-05-15
|
||||
- 关联:`4-27`、`4-35`、`4-38`
|
||||
|
||||
## 现象
|
||||
|
||||
1. File Tree 中点击新建页面后,树不再稳定更新;刷新后最新页面显示也异常。
|
||||
2. 页面树显示为 `新页面`,文件树应显示为 `新页面.md`,但部分路径会显示成 `新页面`。
|
||||
3. 点击 File Tree 的 mindmap 资源 `mindmap-mindmap...` 后,再点击 `新页面.md`,文件树标题会变成 `新页面`,`.md` 消失。
|
||||
|
||||
截图证据:
|
||||
|
||||
- `/mnt/Data1T/mnote/tmp/image copy 103.png`
|
||||
- `/mnt/Data1T/mnote/tmp/image copy 104.png`
|
||||
|
||||
## 已确认冲突点
|
||||
|
||||
### 1. live snapshot filetree renderer 引用了未定义变量
|
||||
|
||||
`rust/crates/mnote-web/src/ssr/pages/layout.rs` 中,`renderFileRows()` 使用了 `activeRowId`,但旧函数签名没有把它作为参数传入。tree live snapshot / delta 调用 `renderSidebarSnapshot()` 时会进入该函数,可能抛出 `ReferenceError`,导致“新建后不更新”。
|
||||
|
||||
修复方向:
|
||||
|
||||
- `renderFileRows(parentId, grouped, activeId, activeRowId)` 显式传入 active row。
|
||||
- 递归调用也继续传入 active row。
|
||||
- `renderFileProjection()` 调用 `currentFileTreeActiveRowId()` 后传入。
|
||||
|
||||
### 2. live snapshot 使用原始页面标题,绕过 `.md` 文件树显示口径
|
||||
|
||||
本地 create 补偿路径 `applyCreatedDocumentLocally() -> upsertFileDocumentRows()` 会把页面标题 `新页面` 显示成 `新页面.md`。
|
||||
|
||||
但 live snapshot / SSR projection 路径直接使用 projection item 的 `title`,导致文件树页面行被重绘成 `新页面`。
|
||||
|
||||
修复方向:
|
||||
|
||||
- live `renderFileRows()` 对 document/doc/markdown 且非 asset 的行统一使用 `fileTreePageTitle(rawTitle)`。
|
||||
- 资源行仍显示资源自身标题,不套页面 `.md` 规则。
|
||||
|
||||
### 3. 文档 pane 标题同步绕过 `.md` 文件树显示口径
|
||||
|
||||
`rust/crates/mnote-web/src/routes/web_shell.rs` 的 `render_document_title_controller_script()` 中,`updateVisibleTitle()` 更新文件树 row title 时使用原始 `title`,没有经过 `fileTreePageTitle()`。
|
||||
|
||||
这解释了“点击 mindmap 后再点 `新页面.md`,`.md` 消失”:pane 内导航/标题同步链路覆盖了文件树行标题。
|
||||
|
||||
修复方向:
|
||||
|
||||
- 在 title controller 中加入同等 `fileTreePageTitle()`。
|
||||
- page tree / breadcrumb 仍显示页面标题 `新页面`。
|
||||
- filetree document row 显示 `新页面.md`。
|
||||
|
||||
### 4. pane 内导航仍用旧 `index:<documentId>` 选中规则
|
||||
|
||||
`web_shell.rs` 的 `updatePaneChrome()` 中,primary pane 导航后 filetree selected 判断仍是 `index:${documentId}`。
|
||||
|
||||
当前 4-35 口径中,Convex 页面正文默认 row 已迁移为 `doc:<documentId>`,旧 `index` 规则会导致 selection 与 active row 不稳定。
|
||||
|
||||
修复方向:
|
||||
|
||||
- pane 内 primary navigation 统一使用 `doc:<documentId>`。
|
||||
|
||||
## VSCode 参考原则
|
||||
|
||||
参考 `/mnt/Data1T/mnote/design/05-editor-mainline/reference-code/vscode`:
|
||||
|
||||
- 点击打开、active、selection、reveal 是分离状态,不能互相无条件覆盖。
|
||||
- refresh 应更新局部 children / item,不应无条件清空重建整棵树。
|
||||
- label 显示必须由单一口径生成;不能一条路径显示后缀,另一条路径丢后缀。
|
||||
- selection/focus 需要去重,相同 selection 不应重复提交。
|
||||
|
||||
## 验收标准
|
||||
|
||||
- 在 File Tree 点击 `+` 新建页面后,不刷新即可出现新页面 row。
|
||||
- 新建后本地补偿、tree live snapshot、刷新后文件树页面行都显示 `{title}.md`。
|
||||
- 页面树仍显示 `{title}`,不显示 `.md`。
|
||||
- 点击 mindmap 资源后,再点击同页面或其它页面的 filetree `{title}.md`,标题不丢 `.md`。
|
||||
- tree live snapshot / delta 不再因为 `activeRowId is not defined` 中断。
|
||||
|
||||
## 已验证
|
||||
|
||||
- 已新增真实浏览器 smoke,覆盖 create -> live snapshot -> mindmap click -> filetree page click -> `.md` 保持。
|
||||
|
||||
## 验证结果
|
||||
|
||||
Rust 定向测试:
|
||||
|
||||
```bash
|
||||
cargo test --manifest-path rust/Cargo.toml -p mnote-web sidebar_filetree_runtime_uses_markdown_page_row_without_local_index_child -- --nocapture
|
||||
cargo test --manifest-path rust/Cargo.toml -p mnote-web document_shell_returns_page_aggregate_snapshot -- --nocapture
|
||||
```
|
||||
|
||||
真实浏览器 smoke:
|
||||
|
||||
```bash
|
||||
MNOTE_UI_BASE_URL=http://127.0.0.1:3428 node scripts/task444-filetree-create-mindmap-title-cache-smoke.js
|
||||
```
|
||||
|
||||
结果文件:
|
||||
|
||||
- `tmp/task444-filetree-create-mindmap-title-cache-smoke/result.json`
|
||||
- `tmp/task444-filetree-create-mindmap-title-cache-smoke/after-page-click.png`
|
||||
|
||||
关键断言:
|
||||
|
||||
- `fileTreeCreated.title = "新页面.md"`
|
||||
- `afterLive.title = "新页面.md"`
|
||||
- `afterMindmapClick.title = "新页面.md"`
|
||||
- `afterPageClick.title = "新页面.md"`
|
||||
- `afterPageClick.selected = "true"`
|
||||
- 未出现 `activeRowId` / `ReferenceError`。
|
||||
|
||||
备注:smoke 中出现一次 `mnote standalone mindmap mount failed TypeError: Failed to fetch`,但不影响本 bug 的文件树 title / selected 验证;如后续稳定复现,应另归 05-editor-mainline 或 mindmap runtime 方向排查。
|
||||
@@ -0,0 +1,65 @@
|
||||
# 4-40 文件树 mindmap 连续切换闪烁与文件名过长
|
||||
|
||||
## 状态
|
||||
|
||||
- 状态:done
|
||||
- 分类:04-tree-domain
|
||||
- 发现时间:2026-05-15
|
||||
- 关联:`4-38`、`4-39`
|
||||
|
||||
## 现象
|
||||
|
||||
1. 连续点击 File Tree 中的思维导图资源和其它页面时,文件树仍有闪烁感。
|
||||
2. 思维导图资源文件名暴露技术 ID,例如 `mindmap-mindmap_1778854767490.json`,既长又重复。
|
||||
|
||||
## 根因
|
||||
|
||||
1. File Tree 中普通页面点击已经走 `__mnoteDocumentPaneRuntime.openPrimaryDocument()`,可以在当前页面内切换主 pane。
|
||||
2. mindmap 资源点击仍通过 `window.location.assign('/mindmap/...')` 进入对象壳,导致页面壳和 sidebar 重新构建;连续切换时视觉上表现为闪烁。
|
||||
3. mindmap 文件名由 Convex sidebar dataset 的 `mindmap-${mindmap_id}.json` 派生,若 `mindmap_id` 本身已经以 `mindmap_` 开头,就会显示成 `mindmap-mindmap_...json`。
|
||||
4. 由于线上 Convex function 可能仍返回旧文件名,mnote-web 初始渲染和 live projection 也需要做展示层兜底规范化。
|
||||
|
||||
## 修复
|
||||
|
||||
- mindmap 文件树点击改为优先调用 `openPrimaryMindmap()`,在当前 primary pane 内挂载 mindmap 对象,并用 History API 更新 URL。
|
||||
- primary pane 在文档和 mindmap 之间切换时显式卸载对应 runtime,避免残留视图。
|
||||
- File Tree mindmap 行展示名统一兜底为短名:`思维导图-xxxx.json`。
|
||||
- Convex sidebar 源和 Next fallback sidebar 源也同步改为短名口径。
|
||||
- 新增真实浏览器 smoke:`scripts/task445-filetree-mindmap-switch-no-flicker-smoke.js`。
|
||||
|
||||
## 验收标准
|
||||
|
||||
- 连续点击 File Tree mindmap 资源 -> 其它页面 -> 同一 mindmap 资源时,`#sidebar-file-tree-root` DOM 根节点保持稳定,不被整页重建。
|
||||
- URL 可正常切换到 `/mindmap/<documentId>/<mindmapId>` 与 `/documents/<documentId>`。
|
||||
- mindmap 资源行选中时只选中 `asset:<mindmapId>`,不会闪回父页面行。
|
||||
- mindmap 文件名不再显示 `mindmap-mindmap_...json`,长度受控。
|
||||
- 新建页面的 `.md` 文件树标题口径不回退。
|
||||
|
||||
## 验证
|
||||
|
||||
真实浏览器 smoke:
|
||||
|
||||
```bash
|
||||
MNOTE_UI_BASE_URL=http://127.0.0.1:3428 node scripts/task445-filetree-mindmap-switch-no-flicker-smoke.js
|
||||
MNOTE_UI_BASE_URL=http://127.0.0.1:3428 node scripts/task443-filetree-mindmap-click-active-row-smoke.js
|
||||
MNOTE_UI_BASE_URL=http://127.0.0.1:3428 node scripts/task444-filetree-create-mindmap-title-cache-smoke.js
|
||||
```
|
||||
|
||||
Rust / 前端定向验证:
|
||||
|
||||
```bash
|
||||
cargo test --manifest-path rust/Cargo.toml -p mnote-web document_shell_returns_page_aggregate_snapshot -- --nocapture
|
||||
cargo test --manifest-path rust/Cargo.toml -p mnote-web sidebar_tree_runtime_handles_navigation_drag_and_filetree_actions -- --nocapture
|
||||
cargo test --manifest-path rust/Cargo.toml -p mnote-web tree_shell_filetree_renderer_outputs_initial_nested_html_contract -- --nocapture
|
||||
cd wolai-frontend && pnpm test src/lib/sidebar-data.test.ts -- --runInBand
|
||||
```
|
||||
|
||||
`task445` 关键结果:
|
||||
|
||||
- `before.mindmapTitle = "思维导图-7712.json"`
|
||||
- `afterMindmap.fileRootStable = true`
|
||||
- `afterPage.fileRootStable = true`
|
||||
- `afterMindmapAgain.fileRootStable = true`
|
||||
- `failures = []`
|
||||
|
||||
备注:`cargo test --manifest-path rust/Cargo.toml -p mnote-web -- --nocapture` 中仍有一个既有 CSS 体积阈值守卫失败:`MNOTE_CSS.len() < 70000`;本轮未修改 CSS。
|
||||
Reference in New Issue
Block a user