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

RegisterFormContainer: add DEFAULT_HANDLER for onSignIn #6718

Merged
merged 1 commit into from
Feb 25, 2025

Conversation

shaunanoordin
Copy link
Member

@shaunanoordin shaunanoordin commented Feb 25, 2025

PR Overview

Fixes #6715
Package: lib-react-components, but has downstream effects on app-root and possibly app-project

This PR fixes an issue where, if you try to Register a New User on the Zooniverse home page, then an error message appears and the Register modal doesn't close, even though you've successfully created a new user account and signed in(!).

  • The error...
    • ...occurs in lib-react-component's RegisterFormContainer's onSubmit()
    • ...triggers when the onSignIn parameter isn't defined. (As is the case with app-project's PageHeader's AuthModal and lib-content's Introduction's AuthModal)
  • The fix is to simply add a default handler to onSignIn, so it doesn't trigger an existential failure if it's undefined. (i.e. "onSignIn isn't a function" error.)

Note:

  • app-project's PageHeader's AuthModal does implement onSignIn (notably to register the user resource locally), so there's no issue registering a new user on a project page.

Testing

Home Page, part 1:

  • Run app-root and open the home page, i.e. https://local.zooniverse.org:3000/
    • Make sure you're not logged in. Log out, or use an incognito window.
  • Click on the "Register" button on the top menu, to open the Register New User form (modal).
  • Fill in the details for a test user. Click on the "Register" (submit) button at the bottom of the form.
    • Expected: user account created. User is logged in on FEM. Form should close.

Home Page, part 2:

  • As above, but click on the "Register" button under the Introduction section on the Home Page.

Project Page:

Status

Ready for review and/or enhancements.

As of commit c37621e, I'm only providing the minimum fix to the issue to get a patch out ASAP. There's room for additional enhancements:

  • Review app-project's PageHeader and lib-content's Introduction to see if they actually need onSignIn.
  • Update tests to account for onSignIn, if necessary.

If you'd like to take on these enhancements, please spin up a separate PR so we can merge that into this PR (if it's a quick update), or merge it into master after this PR goes out (if the enhancements will take more than a day).

- This will stop the AuthModal from giving errors on a successful sign in,
  as is currently the case on the Zooniverse home page.
@shaunanoordin shaunanoordin requested a review from a team February 25, 2025 20:14
@shaunanoordin shaunanoordin enabled auto-merge (squash) February 25, 2025 20:33
@coveralls
Copy link

Coverage Status

coverage: 75.512% (+0.004%) from 75.508%
when pulling c37621e on fix-6715
into 4a8e44c on master.

@goplayoutside3 goplayoutside3 self-assigned this Feb 25, 2025
Copy link
Contributor

@goplayoutside3 goplayoutside3 left a comment

Choose a reason for hiding this comment

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

Looks good! I'm able to register from the home page and see no error. Thanks for the fix 👍

@shaunanoordin shaunanoordin merged commit 1c40c2a into master Feb 25, 2025
7 checks passed
@shaunanoordin shaunanoordin deleted the fix-6715 branch February 25, 2025 21:37
@github-actions github-actions bot added the approved This PR is approved for merging label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved This PR is approved for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Register New User form shows error after successfully creating account
3 participants