diff --git a/apps/landing/src/app/homepage/_components/HeroSection.tsx b/apps/landing/src/app/homepage/_components/HeroSection.tsx index 783adcd..4618536 100644 --- a/apps/landing/src/app/homepage/_components/HeroSection.tsx +++ b/apps/landing/src/app/homepage/_components/HeroSection.tsx @@ -106,10 +106,9 @@ export function HeroSection() { } setIsInvalid(false); - const result = await submitEmail(email); - if (result.success) { - setShowPopup(true); - } + // Fire and forget - don't block popup on logging failure + submitEmail(email).catch(console.error); + setShowPopup(true); }; const handlePopupClose = () => { @@ -117,8 +116,9 @@ export function HeroSection() { setIsSubmitted(true); }; - const handleWaitlistSubmit = async (data: { selected: string[]; other: string }) => { - await submitWaitlistData(email, data); + const handleWaitlistSubmit = (data: { selected: string[]; other: string }) => { + // Fire and forget - don't block on logging failure + submitWaitlistData(email, data).catch(console.error); }; return ( diff --git a/apps/landing/src/lib/actions/waitlistActions.ts b/apps/landing/src/lib/actions/waitlistActions.ts index 22adb11..0444fb6 100644 --- a/apps/landing/src/lib/actions/waitlistActions.ts +++ b/apps/landing/src/lib/actions/waitlistActions.ts @@ -22,13 +22,15 @@ function isRateLimited(identifier: string): boolean { export async function submitEmail(email: string): Promise<{ success: boolean; error?: string }> { try { if (isRateLimited(email)) { + console.warn('[WAITLIST] Rate limited:', email); return { success: false, error: 'Too many requests' }; } await storeMail(email); + console.log('[WAITLIST] Email stored:', email); return { success: true }; } catch (error) { - console.error('Failed to store email:', error); + console.error('[WAITLIST] Failed to store email:', email, error); return { success: false, error: 'Failed to save' }; } } @@ -39,9 +41,10 @@ export async function submitWaitlistData( ): Promise<{ success: boolean; error?: string }> { try { await updateMail(email, data); + console.log('[WAITLIST] Data updated:', email, data.selected); return { success: true }; } catch (error) { - console.error('Failed to update waitlist data:', error); + console.error('[WAITLIST] Failed to update data:', email, error); return { success: false, error: 'Failed to save' }; } }