Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions hooks/use-bounty-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import {
type BountyFieldsFragment,
} from "@/lib/graphql/generated";

// Fetches a single bounty by ID via GraphQL using the generated useBountyQuery hook.
// Returns the bounty data typed as BountyFieldsFragment, which includes all relations
// (organization, project, bountyWindow, submissions). Query is skipped if no id is provided.

export function useBountyDetail(id: string) {
const { data, ...rest } = useBountyQuery({ id }, { enabled: Boolean(id) });

Expand Down
5 changes: 5 additions & 0 deletions hooks/use-bounty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ interface UseBountyOptions {
enabled?: boolean;
}

// Reusable hook to fetch a single bounty by ID via GraphQL using the generated useBountyQuery hook.
// Returns the bounty data typed as BountyFieldsFragment, which includes all relations
// (organization, project, bountyWindow, submissions). Accepts an optional `enabled` flag
// for external control over when the query fires, falling back to !!id as the default guard.

export function useBounty(id: string, options?: UseBountyOptions) {
const { data, ...rest } = useBountyQuery(
{ id },
Expand Down