From 057ed3ccbf73737faa06eb8f3c833b4b45bad8e0 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Thu, 14 May 2026 17:45:01 +0200 Subject: [PATCH] fix: joinedAt nullable in UserSchema, guard null in profile page --- thoughts-frontend/app/users/[username]/page.tsx | 2 +- thoughts-frontend/app/users/all/page.tsx | 3 ++- thoughts-frontend/lib/api.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/thoughts-frontend/app/users/[username]/page.tsx b/thoughts-frontend/app/users/[username]/page.tsx index 8820fd2..00084a4 100644 --- a/thoughts-frontend/app/users/[username]/page.tsx +++ b/thoughts-frontend/app/users/[username]/page.tsx @@ -188,7 +188,7 @@ export default async function ProfilePage({ params }: ProfilePageProps) { > - Joined {new Date(user.joinedAt).toLocaleDateString()} + Joined {user.joinedAt ? new Date(user.joinedAt).toLocaleDateString() : "Unknown"} diff --git a/thoughts-frontend/app/users/all/page.tsx b/thoughts-frontend/app/users/all/page.tsx index 28f39d0..2456920 100644 --- a/thoughts-frontend/app/users/all/page.tsx +++ b/thoughts-frontend/app/users/all/page.tsx @@ -28,7 +28,8 @@ export default async function AllUsersPage({ ); } - const { items, total, per_page } = usersData;\n const perPage = per_page; + const { items, total, per_page } = usersData; + const perPage = per_page; const totalPages = Math.ceil(total / perPage); return ( diff --git a/thoughts-frontend/lib/api.ts b/thoughts-frontend/lib/api.ts index 544d085..69b0e61 100644 --- a/thoughts-frontend/lib/api.ts +++ b/thoughts-frontend/lib/api.ts @@ -10,7 +10,7 @@ export const UserSchema = z.object({ customCss: z.string().nullable(), local: z.boolean(), isFollowedByViewer: z.boolean(), - joinedAt: z.coerce.date(), + joinedAt: z.coerce.date().nullable(), }); export const MeSchema = UserSchema;