Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

fix: error on username route

Chris Bautistafeb409b54219
diff --git a/apps/web/src/components/user/profile.tsx b/apps/web/src/components/user/profile.tsx
index 3791939b..0e99f4ed 100644
--- a/apps/web/src/components/user/profile.tsx
+++ b/apps/web/src/components/user/profile.tsx
@@ -14,10 +14,11 @@ export const metadata: Metadata = {
export async function Profile({ username: usernameFromQuery }: Props) {
const [, username] = decodeURIComponent(usernameFromQuery).split('@');
- const user = await prisma.user.findFirst({
+
+ const user = await prisma.user.findFirstOrThrow({
where: {
name: {
- equals: username,
+ equals: username ?? '',
},
},
include: {
@@ -25,9 +26,5 @@ export async function Profile({ username: usernameFromQuery }: Props) {
},
});
- if (!user || !username) {
- notFound();
- }
-
return <Dashboard user={user} />;
}