[fix] Group switch modal: prefill availability form with the registration email, not the account email#2816
Conversation
…tion email, not the account email
|
Warning Review limit reached
Next review available in: 42 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughUpdated 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Greptile SummaryThis PR prefills the group-switch availability form with the course registration email.
Confidence Score: 4/5The missing-registration path needs a fix before merging.
apps/website/src/components/courses/GroupSwitchModal.tsx Important Files Changed
Reviews (1): Last reviewed commit: "[fix] Group switch modal: prefill availa..." | Re-trigger Greptile |
| isVisible: !!user && isManualRequest, | ||
| title: 'Update availability (required)', | ||
| subtitle: user ? ( | ||
| subtitle: courseRegistration ? ( |
There was a problem hiding this comment.
Required Link Disappears Without Registration
When the registration query fails or returns no accepted registration, the manual-request section remains visible but this condition removes the required availability link. The user can still see and confirm the update checkbox without being given a way to perform the update.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/website/src/components/courses/GroupSwitchModal.tsx`:
- Around line 358-367: Update the availability section rendering and its
loading/readiness condition in GroupSwitchModal so it requires
courseRegistration, not merely user. Ensure the required checkbox and
availability link become visible together only after courseRegistration is
available, preventing submission before the link can be used.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 34dc89a2-976a-4f97-a6be-8729d8e1d7f4
📒 Files selected for processing (2)
apps/website/src/components/courses/GroupSwitchModal.test.tsxapps/website/src/components/courses/GroupSwitchModal.tsx
| subtitle: courseRegistration ? ( | ||
| <> | ||
| To help us assign you to a group which best suits you, {' '} | ||
| <a | ||
| href={buildAvailabilityFormUrl({ | ||
| email: user.email, | ||
| email: courseRegistration.email, | ||
| utmSource: 'bluedot-group-switch-modal', | ||
| courseRegistration, | ||
| // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing | ||
| roundId: courseRegistration?.roundId || '', | ||
| roundId: courseRegistration.roundId || '', |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Keep the availability section gated by registration readiness.
Line [356] still makes the required section visible when user exists, while this changed block omits the link until courseRegistration is available. Because that query is excluded from isLoading, users can see the checkbox with no link and submit without updating availability. Gate the section and/or loading state on courseRegistration so the required link and checkbox appear together.
Suggested fix
- const { data: courseRegistration } = trpc.courseRegistrations.getByCourseId.useQuery(
+ const { data: courseRegistration, isLoading: isCourseRegistrationLoading } = trpc.courseRegistrations.getByCourseId.useQuery(
- const isLoading = isCourseLoading || isDiscussionsLoading;
+ const isLoading = isCourseLoading || isDiscussionsLoading || isCourseRegistrationLoading;
- isVisible: !!user && isManualRequest,
+ isVisible: !!courseRegistration && isManualRequest,🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/website/src/components/courses/GroupSwitchModal.tsx` around lines 358 -
367, Update the availability section rendering and its loading/readiness
condition in GroupSwitchModal so it requires courseRegistration, not merely
user. Ensure the required checkbox and availability link become visible together
only after courseRegistration is available, preventing submission before the
link can be used.
…ng state and fall back to the account email, so the required availability link always renders
Description
Per the issue description, this is needed to ensure that the link to submit availability goes to the right place after we support changing account emails (#2570)
Issue
Fixes #2811
Developer checklist