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.

fix default sort options for BountySubmissionsTable

Steven Tey9b6c7a8cea63
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.tsx
index 1eadaaf63a..87ba45f4fe 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
@@ -72,8 +72,15 @@ export function BountySubmissionsTable() {
? PERFORMANCE_BOUNTY_SCOPE_ATTRIBUTES[performanceCondition.attribute]
: "Progress";
- const sortBy = searchParams.get("sortBy") || "completedAt";
- const sortOrder = searchParams.get("sortOrder") === "desc" ? "desc" : "asc";
+ const sortBy = useMemo(() => {
+ if (searchParams.get("sortBy")) return searchParams.get("sortBy") as string;
+
+ if (bounty?.type === "performance") return "performanceCount";
+
+ return "completedAt";
+ }, [searchParams, bounty]);
+
+ const sortOrder = searchParams.get("sortOrder") === "asc" ? "asc" : "desc";
const { submissionsCount } =
useBountySubmissionsCount<SubmissionsCountByStatus[]>();