Skip to content

refactor: improve type safety and documentation in bounty mutation hooks#122

Merged
0xdevcollins merged 1 commit intoboundlessfi:mainfrom
wheval:feat/bounty-hooks
Feb 26, 2026
Merged

refactor: improve type safety and documentation in bounty mutation hooks#122
0xdevcollins merged 1 commit intoboundlessfi:mainfrom
wheval:feat/bounty-hooks

Conversation

@wheval
Copy link
Contributor

@wheval wheval commented Feb 25, 2026

Close #103

The bounty write operations have already been fully migrated from REST to GraphQL mutations.
changes i made:

  • Extract MutateOptions type aliases to reduce code duplication
  • Add comprehensive JSDoc comments to all mutation hooks
  • Clarify implementation details for useClaimBounty workaround
  • Improve code readability with cleaner type signatures

Summary by CodeRabbit

  • Refactor
    • Enhanced internal type definitions to improve code maintainability and clarity across mutation operations.

- Extract MutateOptions type aliases to reduce code duplication
- Add comprehensive JSDoc comments to all mutation hooks
- Clarify implementation details for useClaimBounty workaround
- Improve code readability with cleaner type signatures
@vercel
Copy link

vercel bot commented Feb 25, 2026

@wheval is attempting to deploy a commit to the Threadflow Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

This PR introduces three type aliases for mutation options in the bounty mutations hook and replaces explicit inline type annotations with these new aliases across four bounty mutation hooks, improving code readability and type consistency without altering runtime behavior.

Changes

Cohort / File(s) Summary
Type Aliases & Mutation Hook Refactoring
hooks/use-bounty-mutations.ts
Added three new type aliases (CreateBountyMutateOptions, UpdateBountyMutateOptions, DeleteBountyMutateOptions) and replaced verbose inline MutateOptions<...> type annotations with these aliases across useCreateBounty, useUpdateBounty, useDeleteBounty, and useClaimBounty hooks for both mutate and mutateAsync signatures.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • 0xdevcollins

Poem

🐰 Type aliases hop into the scene,
Where verbose lines once reigned supreme,
Now CreateBounty and friends align,
Four hooks dance in rhythm divine,
Less repetition, more clarity to glean!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: refactoring to improve type safety and documentation in bounty mutation hooks, which aligns with the extracted type aliases and added JSDoc comments.
Linked Issues check ✅ Passed The PR fulfills all coding requirements from #103: migrations to GraphQL mutations (useCreateBountyMutation, useUpdateBountyMutation, useDeleteBountyMutation), workaround for useClaimBounty using updateBounty, preserved optimistic update logic, and type safety improvements.
Out of Scope Changes check ✅ Passed All changes are scoped to hooks/use-bounty-mutations.ts and directly support the objectives: type aliases reduce duplication, JSDoc comments improve documentation, and type signature updates enhance code readability without altering control flow.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@hooks/use-bounty-mutations.ts`:
- Around line 73-82: Update the JSDoc on the useUpdateBounty hook to accurately
state that undefined/null filtering is applied only when shaping the optimistic
cache in the onMutate handler and not automatically applied to the actual
mutation payload sent to the server; reference the useUpdateBounty hook and its
onMutate optimistic update logic so readers know where filtering occurs and add
a note that callers should trim undefined/null fields from the mutation input if
they expect the server payload to exclude them.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1c735c5 and 11f7e29.

📒 Files selected for processing (1)
  • hooks/use-bounty-mutations.ts

@wheval
Copy link
Contributor Author

wheval commented Feb 26, 2026

@0xdevcollins please review

@0xdevcollins 0xdevcollins merged commit 3867df8 into boundlessfi:main Feb 26, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate bounty mutation hooks to GraphQL

2 participants