From 32226739b730fa1770feb6dbfa13126fc729f01b Mon Sep 17 00:00:00 2001 From: neodk2004 Date: Sat, 6 Jun 2026 09:59:01 +0200 Subject: [PATCH] =?UTF-8?q?fix(01-02):=20move=20onboarding/pet=20outside?= =?UTF-8?q?=20(app)=20group=20=E2=80=94=20breaks=20redirect=20loop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/{(app) => }/onboarding/pet/page.tsx | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) rename src/app/{(app) => }/onboarding/pet/page.tsx (51%) diff --git a/src/app/(app)/onboarding/pet/page.tsx b/src/app/onboarding/pet/page.tsx similarity index 51% rename from src/app/(app)/onboarding/pet/page.tsx rename to src/app/onboarding/pet/page.tsx index 8acf0d0..0ff8751 100644 --- a/src/app/(app)/onboarding/pet/page.tsx +++ b/src/app/onboarding/pet/page.tsx @@ -1,19 +1,19 @@ +import { auth } from "@clerk/nextjs/server"; +import { redirect } from "next/navigation"; + /** * Onboarding pet page — /onboarding/pet * - * Landing page shown when an authenticated owner has no pets yet. - * The app shell layout.tsx redirects here when pets.length === 0. + * Shown when an authenticated owner has no pets yet. + * Lives OUTSIDE the (app) layout group to avoid the redirect loop: + * app layout sees 0 pets → redirects here → this page has no pet check. * - * UI-SPEC: Pet Profile Screens — Create First Pet (onboarding) - * - Heading: "Add your first pet" (text-xl font-semibold) - * - Subheading: "Your pet will be their own star on OnlyPets." (text-sm text-muted-foreground) - * - PetForm placeholder (wired in Plan 03) - * - * This page is intentionally outside the (app) layout's pet-list check — - * owners are redirected HERE when they have no pets, so the shell must - * render without requiring an existing pet. + * PetForm is wired in Plan 03. */ -export default function OnboardingPetPage() { +export default async function OnboardingPetPage() { + const { userId } = await auth(); + if (!userId) redirect("/log-in"); + return (