Skip to content

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

@yejiming

Description

@yejiming

Feature Description

useHasDraft and useDeleteDraft are exported from src/renderer/hooks/chat/useSendBoxDraft.ts, but there are currently no call sites in the renderer codebase.

Problem Statement

Unused exported hooks increase API surface and maintenance burden. They can also hide intent: contributors cannot tell whether these hooks are incomplete, deprecated, or planned-but-not-integrated.

Proposed Solution

  • Audit useHasDraft and useDeleteDraft usage and expected product behavior.
  • If truly unused:
    • remove both exports and implementation.
  • If they are intended capabilities:
    • add at least one concrete UI integration (e.g., draft indicator in conversation list, clear-draft action),
    • and document expected usage.
  • (Optional cleanup) useHasDraft currently returns data !== undefined, which can evaluate to true even when no draft exists after SWR resolves to false; consider returning Boolean(data) instead.

Feature Category

UI/UX Improvement

Additional Context

Relevant lines in src/renderer/hooks/chat/useSendBoxDraft.ts:

  • useHasDraft: lines 187–193
  • useDeleteDraft: lines 198–212
  • useHasDraft return expression: line 192

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions