Skip to content

Commit 8334adb

Browse files
committed
fix(settings): Clear error messages on submit SigninTokenCode/ConfirmSignupCode
Because: * Error banners were not cleared on submit even if error no longer applied (e.g., throttling) and could result in both an (outdated) error banner and an error tooltip being displayed simultaneously This commit: * clear error messages on submit for both SigninTokenCode and ConfirmSignupCode pages Closes #FXA-11059
1 parent a931774 commit 8334adb

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

  • packages/fxa-settings/src/pages

packages/fxa-settings/src/pages/Signin/SigninTokenCode/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,14 @@ const SigninTokenCode = ({
119119
}
120120
};
121121

122+
const clearErrorMessages = () => {
123+
setLocalizedErrorBannerMessage('');
124+
setCodeErrorMessage('');
125+
};
126+
122127
const onSubmit = useCallback(
123128
async (code: string) => {
129+
clearErrorMessages();
124130
if (!SIX_DIGIT_NUMBER_REGEX.test(code)) {
125131
setCodeErrorMessage(localizedInvalidCode);
126132
return;

packages/fxa-settings/src/pages/Signup/ConfirmSignupCode/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,13 @@ const ConfirmSignupCode = ({
114114
}
115115
}
116116

117+
function clearErrorMessages() {
118+
setLocalizedErrorBannerHeading('');
119+
setCodeErrorMessage('');
120+
}
121+
117122
async function verifySession(code: string) {
123+
clearErrorMessages();
118124
logViewEvent(`flow.${viewName}`, 'submit', REACT_ENTRYPOINT);
119125
GleanMetrics.signupConfirmation.submit();
120126
try {

0 commit comments

Comments
 (0)