Files
mnote/bugs/04-tree-domain/done/4-45-create-child-dead-code-cleanup-v1.md
T

23 lines
959 B
Markdown
Raw Normal View History

2026-05-16 23:48:41 +08:00
# 4-45 [done] `createChildDocumentCommand` 死代码清理
> 更新时间:2026-05-16
>
> 状态:`done`
## 问题
`tree-command-client.ts:225` 定义的 `createChildDocumentCommand` 导出但从未被任何模块 import。它 POST 到 `/api/documents/create-child` 旧 Next.js 路由。指向 `page-command-adapter.ts` 使用 `documents.create` compat alias。
## 修复
- 删除 `createChildDocumentCommand` 函数
- 删除 `DocumentCreateChildCommandResult` 类型(仅被该函数使用)
- 删除 `CreateChildDocumentInput` 类型(仅被该函数使用)
- 删除 `/api/documents/create-child/route.ts` Next.js 路由文件
- 调用者应使用已存在的 `createDocumentCommand(parentId)``/api/tree/commands``tree.node.create`
## 验证
- `grep -rn "createChildDocumentCommand\|DocumentCreateChildCommandResult\|CreateChildDocumentInput"` 确认无源文件引用
- `pnpm test` 中相关测试不应因死代码删除而失败