Skip to content

chore(renderer): remove unused draft hooks#1970

Merged
piorpua merged 1 commit intoiOfficeAI:mainfrom
cdxiaodong:chore/1957-clean-sendbox-draft-hooks
Mar 31, 2026
Merged

chore(renderer): remove unused draft hooks#1970
piorpua merged 1 commit intoiOfficeAI:mainfrom
cdxiaodong:chore/1957-clean-sendbox-draft-hooks

Conversation

@cdxiaodong
Copy link
Copy Markdown
Member

Summary

  • remove the unused useHasDraft and useDeleteDraft exports from useSendBoxDraft
  • keep the active draft hook API focused on getSendBoxDraftHook, which is the only renderer entry point in use today
  • add a hook test that verifies drafts can still be stored and cleared for an active conversation

Test plan

  • bun run lint
  • bun run format
  • bunx tsc --noEmit
  • bun run i18n:types
  • node scripts/check-i18n.js
  • bun run test

Closes #1957

@sentry
Copy link
Copy Markdown

sentry bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 31, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 31, 2026

Code Review:chore(renderer): remove unused draft hooks (#1970)

变更概述

本 PR 从 useSendBoxDraft.ts 中移除了未使用的 useHasDraftuseDeleteDraft 两个导出 hook,同时移除了仅被这两个 hook 使用的 useSWRMutation 导入。新增了一个测试文件验证 getSendBoxDraftHook 的存储和清除草稿功能。改动范围为 renderer 层,共 2 个文件。


方案评估

结论:✅ 方案合理

PR 目标明确——清理未使用的代码,减少模块公开 API 面积。经 grep 确认 useHasDraftuseDeleteDraft 在整个 src/ 目录下无任何引用,删除安全。新增测试覆盖了保留的核心 API getSendBoxDraftHook,验证了草稿的存储和清除流程。方案简洁,与项目架构一致,无过度工程化。


问题清单

✅ 未发现明显问题,代码质量良好,建议批准合并。


汇总

# 严重级别 文件 问题
无问题

结论

批准合并 — 删除的 hook 确认无引用,useSWRMutation 导入清理正确,新增测试覆盖了保留的公开 API。Codecov 报告所有改动行均已覆盖。


本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。

CONCLUSION: APPROVED
IS_CRITICAL_PATH: false
PR_NUMBER: 1970

@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 31, 2026

✅ 已自动 review,无阻塞性问题,正在触发自动合并。

@piorpua piorpua merged commit e589889 into iOfficeAI:main Mar 31, 2026
14 checks passed
@piorpua piorpua added bot:done Auto-merged by bot and removed bot:reviewing Review in progress (mutex) labels Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:done Auto-merged by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Clean up unused draft hooks in useSendBoxDraft (or integrate with real UI entry points)

2 participants