From 6b5d703c6bc65c3274e95a9b3b54616a07223413 Mon Sep 17 00:00:00 2001 From: DongYeop Lee Date: Tue, 3 Nov 2026 18:28:58 -0800 Subject: [PATCH] fix(people): hide yourself from search, show email on cards, fix Date.now() prerender error - /people leaves the signed-in user out of the results and the count. - Cards show the person's email under their name so people with the same name can be told apart. The "(You)" label is gone. - getCurrentUser awaits connection() before the Supabase auth client reads the clock, which removes the "unstable value Date.now()" error every page logged from the header's AuthStatus. Co-Authored-By: Claude Opus 5.5 --- src/app/people/page.tsx | 10 +++++----- src/app/people/profile-card.tsx | 16 ++-------------- src/app/people/profile-detail-modal.tsx | 8 +++++--- src/lib/auth.ts | 3 +++ 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/app/people/page.tsx b/src/app/people/page.tsx index f4575b5..6ccbad5 100644 --- a/src/app/people/page.tsx +++ b/src/app/people/page.tsx @@ -230,7 +230,7 @@ async function PeopleResults({ params.role ); - const [{ profiles, error }, myProfile] = demoMode + const [{ profiles: found, error }, myProfile] = demoMode ? ([ { profiles: filterDemoProfiles( @@ -250,6 +250,9 @@ async function PeopleResults({ getProfile(user.id), ]); + // You're searching for other people, so leave yourself out. + const profiles = found.filter((p) => p.id !== user.id); + return (
{!demoMode && !myProfile && ( @@ -326,10 +329,7 @@ async function PeopleResults({ key={p.id} className="min-w-0" > - + ))} diff --git a/src/app/people/profile-card.tsx b/src/app/people/profile-card.tsx index 736d2a3..1fec6cc 100644 --- a/src/app/people/profile-card.tsx +++ b/src/app/people/profile-card.tsx @@ -1,18 +1,6 @@ import type { DirectoryProfile } from "./demo-profiles"; import { ProfileDetailModal } from "./profile-detail-modal"; -export function ProfileCard({ - profile, - isMe, -}: { - profile: DirectoryProfile; - isMe: boolean; -}) { - return ( - - ); +export function ProfileCard({ profile }: { profile: DirectoryProfile }) { + return ; } \ No newline at end of file diff --git a/src/app/people/profile-detail-modal.tsx b/src/app/people/profile-detail-modal.tsx index 3df1c12..3de9b49 100644 --- a/src/app/people/profile-detail-modal.tsx +++ b/src/app/people/profile-detail-modal.tsx @@ -88,11 +88,9 @@ function ContactRow({ export function ProfileDetailModal({ profile: p, - isMe, card = false, }: { profile: DirectoryProfile; - isMe: boolean; card?: boolean; }) { const dialogRef = useRef(null); @@ -144,7 +142,11 @@ export function ProfileDetailModal({

{p.name} - {isMe ? " (You)" : ""} +

+ + {/* Email tells apart people who share a name. */} +

+ {p.email}

diff --git a/src/lib/auth.ts b/src/lib/auth.ts index e736f6c..76b2424 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -1,6 +1,7 @@ import "server-only"; import { cache } from "react"; import { notFound, redirect } from "next/navigation"; +import { connection } from "next/server"; import { isOrganizer } from "@/lib/data"; import { createClient } from "@/lib/supabase/server"; import { isSupabaseConfigured } from "@/lib/supabase/env"; @@ -10,6 +11,8 @@ export type CurrentUser = { id: string; email: string }; /** The signed-in user, verified from the session JWT. Deduped per request. */ export const getCurrentUser = cache(async (): Promise => { if (!isSupabaseConfigured) return null; + // The auth client reads the clock, so opt out of prerendering before touching it. + await connection(); const supabase = await createClient(); const { data } = await supabase.auth.getClaims();