Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/ui/auth-control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { signIn, useSession } from "next-auth/react";
* client-side (SessionProvider) so the marketing pages stay static.
*/
export default function AuthControl({ compact = false }: { compact?: boolean }) {
const { data: session, status } = useSession();

if (status === "loading") {
return <span className={compact ? "block px-3 py-2" : "px-4 py-2"} aria-hidden="true" />;
}
const { data: session } = useSession();

// While the session is still loading (including SSR, where it always is),
// render the signed-out button: most visitors ARE signed out, and a blank
// placeholder meant the control was invisible on first paint. A signed-in
// user sees the button swap to their name once the session arrives.
if (session?.actorId) {
return (
<Link
Expand Down