feat: introduce TanStack Query integration for bounties, including query options, keys, and prefetching utilities. - #32
Merged
0xdevcollins merged 2 commits intoJan 25, 2026
Conversation
…ery options, keys, and prefetching utilities.
📝 WalkthroughWalkthroughAdds a React Query layer for bounties: a typed query-key factory, query option helpers for list/detail/infinite fetches (including a pages-flatten utility), and server-friendly prefetch utilities with a fresh QueryClient factory. Changes
Sequence Diagram(s)sequenceDiagram
participant Server as "Server Component"
participant QC as "QueryClient"
participant API as "bountiesApi"
Server->>QC: createQueryClient()
Server->>QC: prefetchQuery(bountyListQueryOptions(params))
QC->>API: call bountiesApi.list(params page/limit)
API-->>QC: PaginatedResponse<Bounty>
QC-->>Server: cache populated
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@lib/query/prefetch.ts`:
- Around line 32-37: prefetchBounty currently calls queryClient.prefetchQuery
with bountyDetailQueryOptions(id) even when id is empty (enabled flag is ignored
by prefetchQuery), so add a guard at the top of prefetchBounty to return early
when id is falsy/empty; keep the function signature and simply do if (!id)
return; before calling queryClient.prefetchQuery (reference prefetchBounty and
bountyDetailQueryOptions to locate the code).
In `@lib/query/query-keys.ts`:
- Around line 22-23: BountyQueryKey currently only includes ReturnType<typeof
bountyKeys.list | typeof bountyKeys.detail> but the codebase also uses
bountyKeys.infinite; update the union to include that variant (e.g.
ReturnType<typeof bountyKeys.list | typeof bountyKeys.detail | typeof
bountyKeys.infinite>) so the type covers all active bountyKeys variants used
(referencing bountyKeys and BountyQueryKey to locate the change).
…yKey` to include infinite query keys.
5 tasks
0xDeon
pushed a commit
to 0xDeon/bounties
that referenced
this pull request
Jan 26, 2026
…y-keys-and-query-functions feat: introduce TanStack Query integration for bounties, including query options, keys, and prefetching utilities.
This was referenced Feb 22, 2026
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a comprehensive query management system for bounties using React Query. The changes modularize query key generation, query option factories, and prefetch utilities, making it easier to fetch, cache, and prefetch bounty data throughout the application.
Query Key Management:
bountyKeysinquery-keys.tsfor granular cache control of bounty lists and details. Also exported a type helper for query keys.Query Option Factories:
bounty-queries.tsfor listing bounties (bountyListQueryOptions), fetching single bounty details (bountyDetailQueryOptions), and paginated/infinite queries (bountyInfiniteQueryOptions). Added a helper to flatten paginated results.Prefetch Utilities:
prefetch.tsto create a newQueryClientper request, and to prefetch bounty lists, details, and multiple bounties for server-side rendering or data hydration.Centralized Exports:
index.tsto re-export all query keys, query option factories, and prefetch utilities for easy import throughout the codebase.closes #27
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.