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

10353 Bug: Duplicate Cognito Users update (fix re-enable logic of submit button) #5268

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('Petitioner Account Creation', () => {
cy.get('@accountCreationRequest.all').should('have.length', 1);
});

it('should create an account and verify it using the verification link, then login and create an eletronic case', () => {
it('should create an account and verify it using the verification link, then login and create an electronic case', () => {
const TEST_EMAIL = `cypress_test_account+success_${GUID}@example.com`;
createAPetitioner({
email: TEST_EMAIL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { RequirementsText } from '@web-client/views/CreatePetitionerAccount/Requ
import { connect } from '@web-client/presenter/shared.cerebral';
import { debounce } from 'lodash';
import { sequences, state } from '@web-client/presenter/app.cerebral';
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';

export const CreatePetitionerAccountForm = connect(
{
alertError: state.alertError,
alertWarning: state.alertWarning,
confirmPassword: state.form.confirmPassword,
createAccountHelper: state.createAccountHelper,
navigateToLoginSequence: sequences.navigateToLoginSequence,
Expand All @@ -19,6 +21,8 @@ export const CreatePetitionerAccountForm = connect(
updateFormValueSequence: sequences.updateFormValueSequence,
},
({
alertError,
alertWarning,
confirmPassword,
createAccountHelper,
navigateToLoginSequence,
Expand All @@ -33,9 +37,15 @@ export const CreatePetitionerAccountForm = connect(
const [inFocusName, setInFocusName] = useState(true);
const [submitDisabled, setSubmitDisabled] = useState(false);

// Re-enabled submit button if submission was unsuccessful
useEffect(() => {
if (alertError || alertWarning) {
setSubmitDisabled(false);
}
}, [alertError, alertWarning]);

const submitFunction = debounce(() => {
submitCreatePetitionerAccountFormSequence();
setSubmitDisabled(false);
Copy link
Contributor Author

@Mwindo Mwindo Aug 20, 2024

Choose a reason for hiding this comment

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

On success, this was re-enabling before transitioning to the next page ("Success!"), which was confusing.

}, 500);

return (
Expand Down
Loading