From 7f4389a854bea0a09bc36e18941d51f565e13675 Mon Sep 17 00:00:00 2001 From: Philip Zhang Date: Thu, 27 Jun 2024 16:34:59 -0700 Subject: [PATCH] Bug Fixes (#120) ## Changes - fix null HL crash bug - fix keys on unit grid --- frontend/src/api/referrals.ts | 2 +- frontend/src/api/units.ts | 2 +- frontend/src/components/ReferralTable.tsx | 6 +++++- frontend/src/components/UnitCardGrid.tsx | 2 +- frontend/src/pages/RenterCandidatePage.tsx | 12 ++++++++++-- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/frontend/src/api/referrals.ts b/frontend/src/api/referrals.ts index 57b8f23..c3b78c9 100644 --- a/frontend/src/api/referrals.ts +++ b/frontend/src/api/referrals.ts @@ -8,7 +8,7 @@ export type CreateReferralRequest = { export type UpdateReferralRequest = { id: string; - housingLocator: string; + housingLocator?: string; referringStaff: string; status: string; }; diff --git a/frontend/src/api/units.ts b/frontend/src/api/units.ts index 2929d22..2e1f6f7 100644 --- a/frontend/src/api/units.ts +++ b/frontend/src/api/units.ts @@ -234,7 +234,7 @@ export type Referral = { status: ReferralStatus; renterCandidate: RenterCandidate; unit: Unit; - assignedHousingLocator: User; + assignedHousingLocator?: User; assignedReferringStaff: User; updatedAt: string; createdAt: string; diff --git a/frontend/src/components/ReferralTable.tsx b/frontend/src/components/ReferralTable.tsx index 4d27a7a..f5c841a 100644 --- a/frontend/src/components/ReferralTable.tsx +++ b/frontend/src/components/ReferralTable.tsx @@ -161,7 +161,11 @@ export const ReferralTable = (props: ReferralTableProps) => { } return ( <> - {referral.assignedHousingLocator.firstName + " " + referral.assignedHousingLocator.lastName} + {referral.assignedHousingLocator + ? referral.assignedHousingLocator.firstName + + " " + + referral.assignedHousingLocator.lastName + : "N/A"} ); }; diff --git a/frontend/src/components/UnitCardGrid.tsx b/frontend/src/components/UnitCardGrid.tsx index f882f18..1e99426 100644 --- a/frontend/src/components/UnitCardGrid.tsx +++ b/frontend/src/components/UnitCardGrid.tsx @@ -36,7 +36,7 @@ export const UnitCardGrid = ({ refreshUnits={() => { refreshUnits(showPendingUnits ? "pending" : "approved"); }} - key={index} + key={`${option.listingAddress}_${index}`} /> ))} {units.length === 0 && No matching units found} diff --git a/frontend/src/pages/RenterCandidatePage.tsx b/frontend/src/pages/RenterCandidatePage.tsx index 6575f8e..c391b9c 100644 --- a/frontend/src/pages/RenterCandidatePage.tsx +++ b/frontend/src/pages/RenterCandidatePage.tsx @@ -369,7 +369,11 @@ export function RenterCandidatePage() { } return ( <> - {referral.assignedHousingLocator.firstName + " " + referral.assignedHousingLocator.lastName} + {referral.assignedHousingLocator + ? referral.assignedHousingLocator.firstName + + " " + + referral.assignedHousingLocator.lastName + : "N/A"} ); }; @@ -659,7 +663,11 @@ export function RenterCandidatePage() { {unit.listingAddress} , assignedReferringStaff.firstName + " " + assignedReferringStaff.lastName, - assignedHousingLocator.firstName + " " + assignedHousingLocator.lastName, + assignedHousingLocator + ? assignedHousingLocator.firstName + + " " + + assignedHousingLocator.lastName + : "N/A", status, formatDate(updatedAt.toString()),