refactor(web): align signup mail submit and tests#30456
Conversation
Summary of ChangesHello @lyzno1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the robustness and testability of the email signup form. It transitions the form to a more semantic submission model, incorporates a mechanism to prevent duplicate submissions, and introduces a thorough suite of tests to ensure the component behaves as expected under different conditions and user interactions. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively refactors the signup form's submission flow to use a more semantic onSubmit handler and adds a pending state guard, which are great improvements. The new test suite is also comprehensive and well-structured.
My review includes one critical fix for a missing dependency in a useCallback hook that could cause stale closures. I've also provided a few suggestions to enhance the new tests by adopting some testing best practices, and a minor formatting fix.
There was a problem hiding this comment.
Pull request overview
This PR refactors the signup email form to use semantic HTML form submission patterns and adds comprehensive RTL/Vitest test coverage. The changes align the component with modern React form best practices by replacing the noop form handler with a proper onSubmit handler and changing the button from onClick to type="submit", enabling native form submission via Enter key.
Key changes:
- Replaced form's
nooponSubmit with proper event handler that prevents default and calls handleSubmit - Changed submit button from
onClicktotype="submit"for semantic HTML - Added isPending guard to prevent duplicate submissions during async operations
- Added comprehensive test suite covering rendering, branding visibility, and submit workflows
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| web/app/signup/components/input-mail.tsx | Refactored form to use semantic submit handling with proper onSubmit handler, changed button to type="submit", added isPending guard, removed unused noop import, and fixed whitespace formatting |
| web/app/signup/components/input-mail.spec.tsx | Added new test file with RTL/Vitest coverage for rendering, branding visibility, successful submission, and edge cases including invalid email and failed mutation scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes #30455
Summary
Align signup email form with semantic submit handling (form onSubmit + submit button), add pending guard, and add RTL/Vitest coverage for rendering, branding visibility, and submit outcomes.
Tests:
pnpm test app/signup/components/input-mail.spec.tsxScreenshots
Checklist
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods