Skip to content

Split useInvoiceForm into useLineItems and useInvoiceMeta sub-hooks #635

Description

@Kingsman-99

Description

useInvoiceForm manages both invoice metadata (title, dates, currency, recipients) and line-item state in a single hook, making it over 300 lines and hard to maintain. Splitting it into useLineItems (item CRUD, totals, reordering) and useInvoiceMeta (top-level fields, validation) improves cohesion and testability.

Acceptance Criteria

  • src/hooks/useLineItems.ts contains all line-item state and handlers
  • src/hooks/useInvoiceMeta.ts contains all invoice-level metadata state and validation
  • useInvoiceForm is updated to compose the two sub-hooks and re-export a unified API so callers require no changes
  • No existing call site for useInvoiceForm needs to be modified
  • Existing tests continue to pass

Context

  • Target file: src/hooks/useInvoiceForm.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions