Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Load program rewards only for the Invitations tab

Rafi43ed4f69b825
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/page-client.tsx
index 15e19b8050..19f0f2fcf9 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/page-client.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/page-client.tsx
@@ -151,7 +151,9 @@ function ProgramsGridSkeleton() {
function ProgramsGrid({ tab, search }: { tab: ProgramTab; search?: string }) {
const { programEnrollments, isLoading } = useProgramEnrollments({
- includeRewardsDiscounts: true,
+ // only the invite cards show the rewards and the discount. Leave the
+ // parameter out otherwise, because the API reads "false" as true.
+ ...(tab.id === "invitations" && { includeRewardsDiscounts: true }),
status: tab.statuses.join(","),
search,
});
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/programs-table.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/programs-table.tsx
index f19aa9b0a7..3c94e9a307 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/programs-table.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/programs-table.tsx
@@ -52,7 +52,7 @@ export function ProgramsTable({
const status = tab.statuses.join(",");
const { programEnrollments, isLoading, error } = useProgramEnrollments({
- includeRewardsDiscounts: tab.id === "invitations",
+ ...(tab.id === "invitations" && { includeRewardsDiscounts: true }),
status,
search,
...(sortBy && { sortBy }),