diff --git a/src/components/LocalePicker.tsx b/src/components/LocalePicker.tsx index c411ac7a02c9..b6e59643e499 100644 --- a/src/components/LocalePicker.tsx +++ b/src/components/LocalePicker.tsx @@ -35,7 +35,7 @@ function LocalePicker({account, preferredLocale = CONST.LOCALES.DEFAULT, size = keyForList: language, isSelected: preferredLocale === language, })); - const shouldDisablePicker = AccountUtils.isValidateCodeFormSubmitting(account ?? {}); + const shouldDisablePicker = AccountUtils.isValidateCodeFormSubmitting(account); return ( - account.isLoading && account.loadingForm === (account.requiresTwoFactorAuth ? CONST.FORMS.VALIDATE_TFA_CODE_FORM : CONST.FORMS.VALIDATE_CODE_FORM); +const isValidateCodeFormSubmitting = (account: OnyxEntry) => + account?.isLoading && account.loadingForm === (account.requiresTwoFactorAuth ? CONST.FORMS.VALIDATE_TFA_CODE_FORM : CONST.FORMS.VALIDATE_CODE_FORM); export default {isValidateCodeFormSubmitting}; diff --git a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx index fb7e1958ed7b..8111e8d39afa 100755 --- a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx +++ b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.tsx @@ -77,7 +77,7 @@ function BaseValidateCodeForm({account, credentials, session, autoComplete, isUs const hasError = !!account && !isEmptyObject(account?.errors) && !needToClearError; const isLoadingResendValidationForm = account?.loadingForm === CONST.FORMS.RESEND_VALIDATE_CODE_FORM; const shouldDisableResendValidateCode = isOffline ?? account?.isLoading; - const isValidateCodeFormSubmitting = AccountUtils.isValidateCodeFormSubmitting(account ?? {}); + const isValidateCodeFormSubmitting = AccountUtils.isValidateCodeFormSubmitting(account); useEffect(() => { if (!(inputValidateCodeRef.current && hasError && (session?.autoAuthState === CONST.AUTO_AUTH_STATE.FAILED || account?.isLoading))) {