From 22f5d1be6ec314fedb23dae44f1aac35922436ba Mon Sep 17 00:00:00 2001 From: legend4tech Date: Tue, 24 Feb 2026 07:14:41 +0100 Subject: [PATCH] feat: Migrate useBounty detail hook to GraphQL --- hooks/use-bounty-detail.ts | 4 ++++ hooks/use-bounty.ts | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/hooks/use-bounty-detail.ts b/hooks/use-bounty-detail.ts index 2087cd1d..9150a547 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 029dacf5..0a8e9a3a 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 },