-
Notifications
You must be signed in to change notification settings - Fork 0
update application form for email onboarding flow #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds an email-referral flow: new POST API route at Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant JoinUs as rgba(66,135,245,0.5) JoinUs Component
participant Route as rgba(34,197,94,0.5) /api/email-referrals
participant External as rgba(219,39,119,0.5) External Email API
User->>JoinUs: submit email (+ optional referral)
JoinUs->>JoinUs: client-side validation (zod)
JoinUs->>Route: POST { email, referral? }
Route->>Route: server validation + env var checks
Route->>External: POST JSON with API key header
External-->>Route: 200/4xx/5xx + body (json/text/html)
Route->>Route: parse response, map status/messages
Route-->>JoinUs: success or error JSON
JoinUs->>User: render success or error feedback
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/components/JoinUs.tsx`:
- Around line 38-40: The JoinUs component uses useSearchParams() which in
Next.js 15 requires a Suspense boundary; update the parent component
(JoinUsSection) to either wrap the <JoinUs /> render in a React.Suspense
boundary (e.g., <Suspense fallback={...}><JoinUs /></Suspense>) or convert
JoinUsSection into a Client Component by adding "use client" at the top of
JoinUsSection.tsx so it can safely call useSearchParams; modify the file that
renders <JoinUs /> (JoinUsSection) and ensure an appropriate fallback is
provided when using Suspense.
🧹 Nitpick comments (1)
src/app/api/email-referrals/route.ts (1)
43-50: Consider adding a timeout to the external API call.The fetch request has no timeout, which could cause the request to hang indefinitely if the external API is slow or unresponsive. This could exhaust server resources under load.
⏱️ Suggested fix with timeout
const response = await fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json", "x-form-api-key": apiKey, }, body: JSON.stringify(validationResult.data), + signal: AbortSignal.timeout(10000), // 10 second timeout });
src/components/JoinUs.tsx
Outdated
| const searchParams = useSearchParams(); | ||
| const referral = | ||
| searchParams.get("referral") ?? searchParams.get("ref") ?? undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if JoinUs component is wrapped in Suspense where it's used
rg -n -A 5 -B 2 '<JoinUs' --type tsx --type ts
# Also check for dynamic import with ssr disabled as alternative
rg -n 'dynamic.*JoinUs' --type tsx --type tsRepository: raid-guild/website
Length of output: 117
🏁 Script executed:
#!/bin/bash
# Find all TypeScript/TSX files and search for JoinUs usage
fd -e tsx -e ts | xargs rg -n -A 5 -B 2 '<JoinUs'
# Also search for dynamic imports
fd -e tsx -e ts | xargs rg -n 'dynamic.*JoinUs'
# Check the JoinUs.tsx file itself to see imports
cat -n src/components/JoinUs.tsx | head -30Repository: raid-guild/website
Length of output: 2137
🏁 Script executed:
#!/bin/bash
# Check JoinUsSection.tsx fully
cat -n src/components/JoinUsSection.tsx
# Check join/page.tsx for Suspense or other wrappers
cat -n src/app/join/page.tsx
# Search for Suspense imports in the codebase
rg -n 'import.*Suspense' --type-list | head -20
# Check if Suspense is used anywhere with JoinUs or JoinUsSection
rg -n 'Suspense' src/app/join/page.tsx src/components/JoinUsSection.tsxRepository: raid-guild/website
Length of output: 1706
🏁 Script executed:
#!/bin/bash
# Search for Suspense usage in codebase
rg -n 'Suspense' --type-list
# Correct search for Suspense
rg -n 'Suspense'
# Check if there's a "use client" in JoinUsSection
cat src/components/JoinUsSection.tsx
# Check root layout or other parent components
cat -n src/app/layout.tsx 2>/dev/null | head -50Repository: raid-guild/website
Length of output: 2008
🏁 Script executed:
#!/bin/bash
# Check the Providers component
cat -n src/providers/providers.tsx 2>/dev/null || cat -n src/providers.tsx 2>/dev/null
# Check if there are any other Suspense boundaries in the join path
rg -n 'Suspense' src/app/join/ src/components/Join*
# Check Next.js version to confirm it's 15
cat package.json | grep -A 2 -B 2 '"next"'Repository: raid-guild/website
Length of output: 8958
Add Suspense boundary around JoinUs component.
In Next.js 15, useSearchParams() requires a Suspense boundary to prevent the entire parent tree from becoming dynamic. Wrap <JoinUs /> in JoinUsSection.tsx with <Suspense>, or alternatively mark JoinUsSection as a Client Component with "use client".
🤖 Prompt for AI Agents
In `@src/components/JoinUs.tsx` around lines 38 - 40, The JoinUs component uses
useSearchParams() which in Next.js 15 requires a Suspense boundary; update the
parent component (JoinUsSection) to either wrap the <JoinUs /> render in a
React.Suspense boundary (e.g., <Suspense fallback={...}><JoinUs /></Suspense>)
or convert JoinUsSection into a Client Component by adding "use client" at the
top of JoinUsSection.tsx so it can safely call useSearchParams; modify the file
that renders <JoinUs /> (JoinUsSection) and ensure an appropriate fallback is
provided when using Suspense.
8eefdb6 to
6319a73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/components/JoinUs.tsx`:
- Line 51: Remove or redact PII from console logs in the JoinUs component:
eliminate the console.log("Join Us email submitted:", data) in the submit
handler (and any other console.log calls in the same component around lines
73-85) so emails/submit results are not written to client logs; if lightweight
debugging is required, log only non-PII (e.g., success/failure boolean or
anonymized/id-only info) using the same handler functions or submitEmail
function names to locate the places to change.
| if (isSubmitting) return; // Prevent multiple submissions | ||
|
|
||
| console.log("Join Us form submitted:", data); | ||
| console.log("Join Us email submitted:", data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid logging emails/results to the console (PII exposure).
Client logs can be captured by monitoring tools or shared devices; redact or remove.
🧹 Proposed fix (remove/redact PII from logs)
- console.log("Join Us email submitted:", data);
+ console.log("Join Us email submitted");
...
- console.log("Email referral submitted successfully:", result);
+ console.log("Email referral submitted successfully");
...
- console.error("Failed to submit email referral:", result);
+ console.error("Failed to submit email referral");Also applies to: 73-85
🤖 Prompt for AI Agents
In `@src/components/JoinUs.tsx` at line 51, Remove or redact PII from console logs
in the JoinUs component: eliminate the console.log("Join Us email submitted:",
data) in the submit handler (and any other console.log calls in the same
component around lines 73-85) so emails/submit results are not written to client
logs; if lightweight debugging is required, log only non-PII (e.g.,
success/failure boolean or anonymized/id-only info) using the same handler
functions or submitEmail function names to locate the places to change.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.