From c391f2844a06492c1e94419534e4f4e0f8d64c4d Mon Sep 17 00:00:00 2001 From: Nikolay Bonev Date: Fri, 30 Aug 2024 15:42:16 +0300 Subject: [PATCH 1/2] fix: resolving bug with _count missing when there are no custodies --- app/modules/settings/service.server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/modules/settings/service.server.ts b/app/modules/settings/service.server.ts index 3cb867007..819932879 100644 --- a/app/modules/settings/service.server.ts +++ b/app/modules/settings/service.server.ts @@ -164,7 +164,7 @@ export async function getPaginatedAndFilterableSettingUsers({ role: organizationRolesMap[um.roles[0]], userId: um.user.id, sso: um.user.sso, - custodies: um.user.teamMembers[0]._count.custodies, + custodies: um?.user?.teamMembers?.[0]?._count?.custodies || 0, })); /** From 74220fb86a50b049423bf09043ca52b2f8fb659f Mon Sep 17 00:00:00 2001 From: Nikolay Bonev Date: Fri, 30 Aug 2024 15:43:00 +0300 Subject: [PATCH 2/2] cleanup --- app/routes/_layout+/admin-dashboard+/$userId.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/routes/_layout+/admin-dashboard+/$userId.tsx b/app/routes/_layout+/admin-dashboard+/$userId.tsx index eb5d6f8d0..1856c1aa8 100644 --- a/app/routes/_layout+/admin-dashboard+/$userId.tsx +++ b/app/routes/_layout+/admin-dashboard+/$userId.tsx @@ -6,7 +6,7 @@ import { type CustomTierLimit, } from "@prisma/client"; import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node"; -import { json, redirect } from "@remix-run/node"; +import { json } from "@remix-run/node"; import { useLoaderData, Link, useFetcher } from "@remix-run/react"; import { z } from "zod";