Skip to content

refactor(chat): remove unused send box draft hooks#1958

Merged
piorpua merged 1 commit intoiOfficeAI:mainfrom
yejiming:jimmy/2026-03-30-15-10-23
Mar 31, 2026
Merged

refactor(chat): remove unused send box draft hooks#1958
piorpua merged 1 commit intoiOfficeAI:mainfrom
yejiming:jimmy/2026-03-30-15-10-23

Conversation

@yejiming
Copy link
Copy Markdown
Contributor

Pull Request

Description

This PR addresses stale draft-hook code in the chat send-box draft module.

What changed

  • Confirmed via global reference search that useHasDraft and useDeleteDraft had no business-layer usages.
  • Removed the exported implementations of:
    • useHasDraft
    • useDeleteDraft
  • Cleaned up related comments and removed the now-unused useSWRMutation import.

Why

These hooks looked like dead code and created confusion about expected runtime behavior.
Removing them keeps the draft API surface focused on actually used capabilities and reduces maintenance overhead.

Related Issues

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • Tested on macOS
  • Tested on Windows
  • Tested on Linux
  • My code follows the project's code style guidelines
  • I have performed a self-review of my own code
  • My changes generate no new warnings or errors

Validation commands run

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

Screenshots

N/A (no UI changes)

Additional Context

This PR is intentionally scoped to cleanup only: no behavior was added, and no existing business feature path depended on the removed hooks.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@sentry
Copy link
Copy Markdown

sentry bot commented Mar 30, 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:refactor(chat): remove unused send box draft hooks (#1958)

变更概述

本 PR 从 src/renderer/hooks/chat/useSendBoxDraft.ts 中移除了两个未使用的 hook(useHasDraftuseDeleteDraft)及其唯一依赖 useSWRMutation 的 import。变更范围仅限一个文件,属于纯清理性质的重构。


方案评估

结论:✅ 方案合理

全局搜索确认 useHasDraftuseDeleteDraft 在整个代码库中无任何引用,属于确认的死代码。移除方式干净直接——删除函数定义并清理不再需要的 import,未引入额外变更。方案与项目架构一致,无替代方案需要考虑。


问题清单

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


汇总

无问题。

结论

  • 批准合并 — 纯死代码清理,全局搜索确认无引用,CI 全部通过,Codecov 覆盖率满足要求。

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

CONCLUSION: APPROVED
IS_CRITICAL_PATH: false
PR_NUMBER: 1958

@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 31, 2026

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

@piorpua piorpua merged commit 0fbef7a 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