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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
0d575f5231
commit
db1ca73827
@@ -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<string | null>(null);
|
||||
const [guestData, setGuestData] = useState({
|
||||
|
||||
Reference in New Issue
Block a user