diff --git a/hooks/use-bounty-detail.ts b/hooks/use-bounty-detail.ts index 2087cd1..9150a54 100644 --- a/hooks/use-bounty-detail.ts +++ b/hooks/use-bounty-detail.ts @@ -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) }); diff --git a/hooks/use-bounty.ts b/hooks/use-bounty.ts index 029dacf..0a8e9a3 100644 --- a/hooks/use-bounty.ts +++ b/hooks/use-bounty.ts @@ -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 },