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.ts — useApplyToBounty, useSelectApplicant, useSubmitApplicationWork, useApproveApplicationSubmission, useDeclineApplicant
hooks/use-milestone-mutations.ts — useApplyForSlot, useReleasePayment, useAdvanceContributor, useRemoveContributor, useSendMessage
hooks/use-dispute-mutations.ts — useRaiseDispute
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)
hooks/use-bounty-application.tshas 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.ts—useApplyToBounty,useSelectApplicant,useSubmitApplicationWork,useApproveApplicationSubmission,useDeclineApplicanthooks/use-milestone-mutations.ts—useApplyForSlot,useReleasePayment,useAdvanceContributor,useRemoveContributor,useSendMessagehooks/use-dispute-mutations.ts—useRaiseDisputehooks/use-application-contracts.ts— sharedApplicationContractClienttype,ApplicationError,resolveApplicationClient,toBountyIdBigIntKeep
hooks/use-bounty-application.tsas 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 --noEmitandpnpm lintafter each split.Acceptance criteria
pnpm tsc --noEmitandpnpm lintpassFiles
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)