From 61d42654175a5bb526f11ee5acf5deb0ecdebbe9 Mon Sep 17 00:00:00 2001 From: Joe Karow <58997957+JoeKarow@users.noreply.github.com> Date: Thu, 7 Mar 2024 11:31:12 -0500 Subject: [PATCH] fix: basic info card address display (#1143) * enforce "notVisitable" on BasicListingCard * do not throw error on not found --- .../api/router/location/query.forLocationPage.handler.ts | 1 + packages/api/router/location/query.forVisitCard.handler.ts | 3 ++- .../api/router/organization/query.forOrgPage.handler.ts | 1 + packages/ui/components/sections/ListingBasicInfo.tsx | 6 +++++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/api/router/location/query.forLocationPage.handler.ts b/packages/api/router/location/query.forLocationPage.handler.ts index f0f1e4fc1e..464972ca66 100644 --- a/packages/api/router/location/query.forLocationPage.handler.ts +++ b/packages/api/router/location/query.forLocationPage.handler.ts @@ -25,6 +25,7 @@ export const forLocationPage = async ({ input }: TRPCHandlerParams) => { try { - const result = await prisma.orgLocation.findUniqueOrThrow({ + const result = await prisma.orgLocation.findUnique({ where: { ...globalWhere.isPublic(), id: input, @@ -30,6 +30,7 @@ export const forVisitCard = async ({ input }: TRPCHandlerParams { const isSingleLoc = locations?.length === 1 const location = isSingleLoc ? locations[0] : undefined - const addressLine = {useFormattedAddress(location)} + const formattedAddress = useFormattedAddress(location) + + const addressLine = location?.notVisitable ? null : ( + {formattedAddress} + ) const leaderAttributes = attributes.filter(({ attribute }) => attribute.categories.some(({ category }) => category.tag === 'organization-leadership')