Skip to content

refactor(web): align signup mail submit and tests#30456

Merged
crazywoola merged 3 commits intomainfrom
refactor-input-mail-add-tests
Jan 4, 2026
Merged

refactor(web): align signup mail submit and tests#30456
crazywoola merged 3 commits intomainfrom
refactor-input-mail-add-tests

Conversation

@lyzno1
Copy link
Member

@lyzno1 lyzno1 commented Jan 2, 2026

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.tsx

Screenshots

Before After
N/A N/A

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
Copilot AI review requested due to automatic review settings January 2, 2026 04:42
@lyzno1 lyzno1 requested review from douxc and iamjoel as code owners January 2, 2026 04:42
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jan 2, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Semantic Form Submission: The signup email form's submission flow has been refactored to use semantic HTML form handling, utilizing the form onSubmit event and a type="submit" button.
  • Pending Guard Implementation: A pending guard has been added to the form submission logic, preventing multiple submissions while an email sending request is already in progress.
  • Enhanced Test Coverage: Comprehensive unit tests using React Testing Library (RTL) and Vitest have been introduced for the input-mail component, covering rendering, conditional branding visibility, and various submission outcomes (success, failure, invalid input).

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@lyzno1 lyzno1 changed the title Refactor signup email form submit flow and tests refactor(web): align signup mail submit and tests Jan 2, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 noop onSubmit with proper event handler that prevents default and calls handleSubmit
  • Changed submit button from onClick to type="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.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 4, 2026
@crazywoola crazywoola merged commit f167e87 into main Jan 4, 2026
14 checks passed
@crazywoola crazywoola deleted the refactor-input-mail-add-tests branch January 4, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

3 participants