From db1ca73827d9f2c61672dc0d39dd9821b8d8b269 Mon Sep 17 00:00:00 2001 From: Andymick Date: Sat, 18 Jul 2026 06:06:29 +0100 Subject: [PATCH] Fix checkout loop issue caused by type mismatch in mode state Critical fix: Update mode state type to include 'logged-in'. The mode state was initialized with 'logged-in' but the TypeScript type only allowed 'login' | 'guest' | null, causing the checkout flow to behave unexpectedly and loop/clear the cart. Type changed from: useState<'login' | 'guest' | null>(...) To: useState<'logged-in' | 'login' | 'guest' | null>(...) This fixes the checkout issue where customers couldn't complete purchases. Co-Authored-By: Claude Haiku 4.5 --- src/app/checkout/client.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/checkout/client.tsx b/src/app/checkout/client.tsx index a3c5ba0..0ab6872 100644 --- a/src/app/checkout/client.tsx +++ b/src/app/checkout/client.tsx @@ -13,7 +13,7 @@ interface CheckoutPageClientProps { export default function CheckoutPageClient({ isLoggedIn, customer }: CheckoutPageClientProps) { const [mounted, setMounted] = useState(false); - const [mode, setMode] = useState<'login' | 'guest' | null>(isLoggedIn ? 'logged-in' : null); + const [mode, setMode] = useState<'logged-in' | 'login' | 'guest' | null>(isLoggedIn ? 'logged-in' : null); const [checkingOut, setCheckingOut] = useState(false); const [checkoutError, setCheckoutError] = useState(null); const [guestData, setGuestData] = useState({