"use client"; import { createContext, useContext } from "react"; import type { PublicProfile } from "@/lib/social"; /** Set by the /u/[handle] layout after it fetches the profile. Child * pages read it to render content (e.g. the Collections tab needs the * profile's `public_collections` array) without a second fetch. */ export const PublicProfileContext = createContext(null); export function usePublicProfile(): PublicProfile { const v = useContext(PublicProfileContext); if (!v) { throw new Error( "usePublicProfile must be used inside the /u/[handle] layout", ); } return v; }