The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Refactor useBounty hook loading state
Kiran K0268e04c2a84
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-header.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-header.tsxindex d13aa632af..f906281377 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-header.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-header.tsx@@ -7,14 +7,14 @@ import Link from "next/link";import { redirect } from "next/navigation";export function BountyHeaderTitle() {- const { bounty, isLoading } = useBounty();+ const { bounty, loading } = useBounty();const { slug: workspaceSlug } = useWorkspace();- if (isLoading) {+ if (loading) {return <div className="h-7 w-32 animate-pulse rounded-md bg-neutral-200" />;}- if (!bounty) {+ if (!bounty && !loading) {redirect(`/${workspaceSlug}/program/bounties`);}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsxindex 597c867e3d..82daa8bc1b 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx@@ -57,7 +57,7 @@ const PERFORMANCE_ATTRIBUTE_TO_SORTABLE_COLUMNS = {} as const;export function BountySubmissionsTable() {- const { bounty, isLoading: isBountyLoading } = useBounty();+ const { bounty, loading: isBountyLoading } = useBounty();const { groups } = useGroups();const { id: workspaceId } = useWorkspace();const { bountyId } = useParams<{ bountyId: string }>();diff --git a/apps/web/lib/swr/use-bounty.ts b/apps/web/lib/swr/use-bounty.tsindex d412a1e828..ded030fd95 100644--- a/apps/web/lib/swr/use-bounty.ts+++ b/apps/web/lib/swr/use-bounty.ts@@ -8,11 +8,7 @@ export default function useBounty() {const { id: workspaceId } = useWorkspace();const { bountyId } = useParams<{ bountyId: string }>();- const {- data: bounty,- error,- isLoading,- } = useSWR<BountyExtendedProps>(+ const { data: bounty, error } = useSWR<BountyExtendedProps>(workspaceId && bountyId? `/api/bounties/${bountyId}?workspaceId=${workspaceId}&includeExpandedFields=true`: undefined,@@ -21,7 +17,7 @@ export default function useBounty() {return {bounty,- isLoading,+ loading: !bounty && !error,error,};}