-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$500] Web - Bank Account - Error is shown when clicking on name field #31890
Comments
Triggered auto assignment to @johncschuster ( |
Job added to Upwork: https://www.upwork.com/jobs/~01f83b7fb2dea297a0 |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @alitoshmatov ( |
Proposalfrom: @unicorndev-727 Please re-state the problem that we are trying to solve in this issue.Error is shown when clicking on name field. What is the root cause of that problem?The root cause is because getDefaultStateForField returns empty value for the fields that doesn't enter any value before and if any input lost focus, validate function will be called so that an empty value error shows.
What changes do you think we should make in order to solve the problem?We can disable App/src/pages/ReimbursementAccount/RequestorStep.js Lines 136 to 143 in d985a0e
to
What alternative solutions did you explore? (Optional)I'm not sure if this mechanism is intentional and we need to update. |
ProposalPlease re-state the problem that we are trying to solve in this issue.Error is shown when clicking on name field What is the root cause of that problem?Note: Apart from the last name field, the problem seems to also be reproduced with different fields such as dob, personal address, SSN, city, and zip code. Hence, these other fields also need to be addressed. The root cause of the problem is that by default the App/src/components/Form/FormProvider.js Lines 89 to 91 in d985a0e
This extra validation seems unnecessary because the form will also be validated when the App/src/components/Form/FormProvider.js Lines 282 to 284 in d985a0e
App/src/components/Form/FormProvider.js Lines 300 to 302 in d985a0e
What changes do you think we should make in order to solve the problem?Apply, |
ProposalPlease re-state the problem that we are trying to solve in this issue.Error is shown when clicking on name field What is the root cause of that problem?App/src/components/Form/FormProvider.js Lines 277 to 285 in d985a0e
The root cause is because of setTimeout on the onBlur function above. What changes do you think we should make in order to solve the problem?We could remove the setTimeout of the onBlur, because I have tried to change focus from textinput to checkbox and removing the settimeout will not produce the issue of the comment of the setTimeout. Maybe because react native web update effect. - setTimeout(() => {
if (relatedTargetId && _.includes([CONST.OVERLAY.BOTTOM_BUTTON_NATIVE_ID, CONST.OVERLAY.TOP_BUTTON_NATIVE_ID, CONST.BACK_BUTTON_NATIVE_ID], relatedTargetId)) {
return;
}
setTouchedInput(inputID);
if (shouldValidateOnBlur) {
onValidate(inputValues, !hasServerError);
}
- }, 200); additionally if we want to follow the guideline of form validation in : to validate |
ProposalPlease re-state the problem that we are trying to solve in this issue.Error is shown on the first touch of the required fields What is the root cause of that problem?' Within the code snippet found at this link, we validate the input values. This process involves two key functions:
What changes do you think we should make in order to solve the problem?what we want to do is to prevent the isRequired erros on the first touch of any field:
function getFieldRequiredErrors(values: OnyxCommon.Errors, requiredFields: string[], focusedField: string) {
const errors: OnyxCommon.Errors = {};
requiredFields.forEach((fieldKey) => {
if (isRequiredFulfilled(values[fieldKey]) || (focusedField && fieldKey === focusedField)) {
return;
}
errors[fieldKey] = 'common.error.fieldRequired';
});
return errors;
}
const validate = (values, focusedField) => {
const errors = ValidationUtils.getFieldRequiredErrors(values, REQUIRED_FIELDS, focusedField);
const touchedInputId = useRef(null); also inside the const validateErrors = validate(values, touchedInputId.current) || {}; also set the touchedInputId in the touchedInputId.current = inputID; finally in the } else {
touchedInputId.current = null;
} POC:Screen.Recording.2023-11-27.at.3.08.41.AM.mov |
Dupe of #31570 |
@situchan @alitoshmatov just to confirm, Is the issue's video is the expected result? |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: v1.4.3-6
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by:
Slack conversation: @
Action Performed:
Expected Result:
Clicking on a Name field does not cause an error
Actual Result:
Clicking on a name field causes an error
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Bug6290099_1700897846157.test16_Name_field_error.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: