Skip to content

Split hooks/use-bounty-application.ts (755 lines) into per-domain files #276

Description

@Benjtalkshow

hooks/use-bounty-application.ts has grown to 755 lines and 10+ exported mutation hooks across unrelated domains: applications, contracts, disputes, milestones, maintainer actions. It's a constant merge-conflict surface (PRs #256, #265, and #253 all stepped on it) and recent merges have already lost or corrupted parts of the file twice.

What to do

Split into per-domain files under hooks/:

  • hooks/use-application-mutations.tsuseApplyToBounty, useSelectApplicant, useSubmitApplicationWork, useApproveApplicationSubmission, useDeclineApplicant
  • hooks/use-milestone-mutations.tsuseApplyForSlot, useReleasePayment, useAdvanceContributor, useRemoveContributor, useSendMessage
  • hooks/use-dispute-mutations.tsuseRaiseDispute
  • hooks/use-application-contracts.ts — shared ApplicationContractClient type, ApplicationError, resolveApplicationClient, toBountyIdBigInt

Keep hooks/use-bounty-application.ts as a thin barrel that re-exports from the new files so existing callers don't break.

Update grep references one file at a time. Run pnpm tsc --noEmit and pnpm lint after each split.

Acceptance criteria

  • No single file over 300 lines
  • All existing imports still resolve through the barrel
  • Each new file has a clear single responsibility
  • pnpm tsc --noEmit and pnpm lint pass

Files

  • hooks/use-bounty-application.ts (becomes barrel)
  • hooks/use-application-mutations.ts (new)
  • hooks/use-milestone-mutations.ts (new)
  • hooks/use-dispute-mutations.ts (new)
  • hooks/use-application-contracts.ts (new)

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions