TRAP 01
Unvalidated Network Spam & Rate Limits
Sending raw inputs straight to Supabase consumes API request quotas and database connection pools for strings that are obviously malformed (e.g. "example" or blank spaces).
Solution: Enforce strict pre-submission gating (`if (!isValid) return;`). Validate format locally in 0ms before allowing network dispatches.
TRAP 02
Generic Vague Alerts vs Explanatory Feedback
Displaying a generic "Invalid input" or flashing a red outline without explaining what is wrong leaves visitors confused and causes up to 68% form abandonment.
Solution: Deconstruct the input syntactically to explain *why* it failed (e.g. "Please include an '@' in the email address. 'example' is missing an '@'.").
TRAP 03
Client-Only Validation Security Blindspots
Relying solely on frontend JavaScript validation is dangerous because attackers or bots can bypass client logic via direct cURL or REST calls.
Solution: Implement defense-in-depth: pair client validation with PostgreSQL CHECK constraints (chk_valid_email_format) in Supabase.
TRAP 04
Duplicate Email Crash (PostgreSQL Error 23505)
When a user who already joined submits again, PostgreSQL throws a unique violation (`23505`). In naive Bolt apps, this throws an unhandled Promise rejection or crashes the UI.
Solution: Catch error.code === '23505' in the Supabase response and present a friendly message: *"You're already subscribed to Exclusive Coffee Perks!"*.
TRAP 05
Ephemeral State Loss on Error
Resetting form fields when an error occurs forces visitors to re-type their entire name and details, leading to extreme user frustration.
Solution: Retain field values, keep focus on the invalid element, and preserve all valid inputs across validation cycles.