From c9d3aa626ceba354c7fd18e04c63fac896acb6a6 Mon Sep 17 00:00:00 2001 From: aamoghS Date: Thu, 24 Sep 2026 23:17:18 -0400 Subject: [PATCH] fix(web): load a judge's assignments when approved for another edition /judge only fetched getMyAssignments when judge.isJudge was true, and isJudge answers for the current edition only. Assignments span every edition, so a judge approved for an edition other than the resolved current one never loaded them: the card said "Application pending review" with no "Ready to Judge" link. The query now also runs when any of the caller's applications is approved. --- sites/mainweb/app/(portal)/judge/page.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sites/mainweb/app/(portal)/judge/page.tsx b/sites/mainweb/app/(portal)/judge/page.tsx index 3b16547c..9a5e6b1c 100644 --- a/sites/mainweb/app/(portal)/judge/page.tsx +++ b/sites/mainweb/app/(portal)/judge/page.tsx @@ -31,16 +31,23 @@ export default function JudgePage() { trpc.judge.isJudge.useQuery(undefined, { enabled: !!session }); const { data: hackathons, isLoading: hackathonsLoading } = trpc.hackathon.list.useQuery({}); - const { data: assignments } = trpc.judge.getMyAssignments.useQuery( - undefined, - { enabled: !!session && !!judgeStatus?.isJudge }, - ); // Applications, approved or not. getMyAssignments only returns approved ones, // so without this an applicant saw "Apply to Judge" again — and pressing it // threw "You have already applied". const { data: applications } = trpc.judge.myApplications.useQuery(undefined, { enabled: !!session, }); + // Gated on any approved application, not isJudge: isJudge answers for the + // current edition only, while assignments span every edition, so a judge + // approved for another one saw "Application pending review" forever. + const { data: assignments } = trpc.judge.getMyAssignments.useQuery( + undefined, + { + enabled: + !!session && + !!(judgeStatus?.isJudge || applications?.some((a) => a.approved)), + }, + ); // The approval email points here. Rendering nothing for a signed-out visitor // turned an expired session into a broken link.