Skip to content
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

Implement debounced validation for username and email fields βœ… #3240

Closed

Conversation

ManasRanjanSahoo11
Copy link

πŸš€ Adding SignupForm with Smart Debounced Validation!

🎯 What's New?

I am adding debounced user-friendly validation for usernames and email addresses. Say goodbye to unnecessary API calls and hello to a smoother, more responsive user experience!

✨ Key Improvements:

  • πŸ• Smart Timing: Validation kicks in after 300ms of user inactivity, reducing server load and improving responsiveness.
  • πŸ”„ Instant Reset: The timer resets with each keystroke, ensuring accurate validation of the final input.
  • πŸ‘€ Visual Feedback: Users now see a "Validating..." indicator, keeping them informed of behind-the-scenes action.
  • πŸ›  Custom Hook Magic: Introducing our sleek useDebounce hook for efficient state management.
  • 🧹 Cleaner Dependencies: Removed lodash for a leaner, meaner codebase.

πŸ” Technical Details:

  • Implemented a custom useDebounce hook to manage validation timing.
  • Updated validateUsername and validateEmail functions to leverage debounced logic.
  • A Promise-based structure was added to handle asynchronous validation smoothly.

πŸ“Š Expected Impact:

  • Significantly reduced the number of API calls during form completion.
  • Enhanced user experience with responsive and intuitive validation feedback.
  • Improved overall performance and efficiency of the signup process.

πŸ§ͺ Testing Notes:

Please verify the following scenarios:

  1. Rapid typing in username/email fields should not trigger immediate validation.
  2. Validation should occur 300ms after stopping typing.
  3. "Validating..." indicator should appear and disappear appropriately.
  4. Existing validation error messages should still display correctly.

Copy link

welcome bot commented Sep 21, 2024

πŸŽ‰ Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already.

Copy link

release-com bot commented Sep 21, 2024

Release Environments

This Environment is provided by Release, learn more!
To see the status of the Environment click on Environment Status below.

πŸ”§Environment Status : https://app.release.com/public/Processing%20Foundation/env-88d15b1663

@raclim
Copy link
Collaborator

raclim commented Oct 4, 2024

Thank you for submitting this! After giving this a look, although this handles the debounce properly, there's a few issues and places for improvement here!

Since the debounce logic for the username and email fields are pretty similar, I think this could be refactored to have some consolidation there. There also seems to be a few linting and styling issues. For example, besides the ones caught by the linter, we'd also prefer to keep as much as the original file as possible, and would probably want to revert areas like line 150-151 for readability.

After doing some functional testing, there also seems to be inconsistent changes to the size of the input fields when a user tries to type into it. This might be due to the addition of the "Validating..." text underneath it, and might require some CSS changes there.

Due to some of the issues described I don't think we can merge this in at the moment. I'm going to close this for now, but please feel free to reopen this PR or create a new one with any additional changes!

@raclim raclim closed this Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants