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

[$500] IdentityForm #10729

Closed
8 tasks
neil-marcellini opened this issue Aug 31, 2022 · 69 comments
Closed
8 tasks

[$500] IdentityForm #10729

neil-marcellini opened this issue Aug 31, 2022 · 69 comments
Assignees
Labels
Engineering External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item. Reviewing Has a PR in review Weekly KSv2

Comments

@neil-marcellini
Copy link
Contributor

neil-marcellini commented Aug 31, 2022

Coming from the New Expensify Forms design doc, we should refactor the inputs within the IdentityForm to be compatible with the new Form component, following the guidelines below:

Here's an example of a Form refactor: #9056
Here is a component that had its inputs refactored to be compatible with Form.js.

Guidelines

Contributors should first read FORMS.md.
The refactored inputs should be functional when wrapped by Form.js and when not.

  1. Add an optional inputID prop.
  2. Add an optional shouldSaveDraft prop that defaults to false.
  3. Make the value prop optional.
  4. Change any onChange prop, e.g. onTextChange to onChange.
  5. In the input’s onBlur method, call props.onBlur().
  6. In the input’s onChange method, call props.onChange() .
  7. Remove the hasError prop.
  8. Update the error message to display if errorText is truthy.
  9. Make sure that props.ref is attached to the appropriate DOM node. This could involve forwarding the ref to a child component.
  10. Make sure the ref is exposing both value and focus().
  11. Add an optional maxLength prop to text inputs and UI to display the current character count out of the limit.
  12. Add a hint prop and display the text under the input if there is no existing error.
  13. Remove any unused code.

Testing

Verify that:

  • UI looks as it did before the refactor
  • Values can be added and edited
  • Errors are highlighted correctly (input border)
  • Error messages show up correctly
  • Draft values are saved properly
  • Form alerts are displayed correctly
  • Clicking the fix the errors link focuses the first input with error
  • No duplicate submission of the form occurs (when it's already submitting)
@neil-marcellini neil-marcellini added External Added to denote the issue can be worked on by a contributor Engineering labels Aug 31, 2022
@melvin-bot
Copy link

melvin-bot bot commented Aug 31, 2022

Triggered auto assignment to @JmillsExpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@neil-marcellini
Copy link
Contributor Author

It might be a good idea to price this issue at $500+ right away since it's a precursor to the RequestorStep refactor.

@mollfpr
Copy link
Contributor

mollfpr commented Aug 31, 2022

@neil-marcellini May I know the plan for deploying this form? Is this form will be deployed before refactoring ACHContractStep and RequestStep?

I also think the proposal should include refactoring AddressForm (since it's been used in IdentityForm).

@neil-marcellini neil-marcellini changed the title [Form Refactor] IdentityForm [HOLD 10738] [Form Refactor] IdentityForm Sep 1, 2022
@neil-marcellini
Copy link
Contributor Author

Great point about the AddressForm. I created this issue to refactor it #10738. I also updated this description because this refactor will only involve updating the inputs to be compatible with Form.js. Please submit your proposal for AddressForm. Thanks.

@neil-marcellini
Copy link
Contributor Author

deployed before refactoring ACHContractStep and RequestStep?

Yes. We will start with AddressForm, then IdentityForm, and then RequestorStep. Then eventually ACHContractStep.

@mollfpr
Copy link
Contributor

mollfpr commented Sep 1, 2022

@neil-marcellini Got it! I'm on my way to send the proposal for AddressForm.

@melvin-bot melvin-bot bot added the Overdue label Sep 5, 2022
@JmillsExpensify
Copy link

Just created an Upwork job here: https://www.upwork.com/jobs/~01604cc324bbf955b6. I went ahead and started the posting at $500. cc @neil-marcellini

@melvin-bot melvin-bot bot removed the Overdue label Sep 5, 2022
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Sep 5, 2022
@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2022

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel (Exported)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 5, 2022
@melvin-bot
Copy link

melvin-bot bot commented Sep 5, 2022

Triggered auto assignment to @luacmartins (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot changed the title [HOLD 10738] [Form Refactor] IdentityForm [$250] [HOLD 10738] [Form Refactor] IdentityForm Sep 5, 2022
@JmillsExpensify JmillsExpensify changed the title [$250] [HOLD 10738] [Form Refactor] IdentityForm [$500] [HOLD 10738] [Form Refactor] IdentityForm Sep 5, 2022
@JmillsExpensify
Copy link

Proposals happening in #10738. We're still on hold until that one goes through.

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Sep 7, 2022
@luacmartins
Copy link
Contributor

I'm ooo until Wednesday. Will come back to this when I'm back!

@melvin-bot melvin-bot bot added the Awaiting Payment Auto-added when associated PR is deployed to production label Nov 9, 2022
@melvin-bot melvin-bot bot changed the title [$500] IdentityForm [HOLD for payment 2022-11-16] [$500] IdentityForm Nov 9, 2022
@melvin-bot
Copy link

melvin-bot bot commented Nov 9, 2022

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.25-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2022-11-16. 🎊

@JmillsExpensify
Copy link

Nice work getting this merged! I'll circle back in the coming days when the regression period has ended.

@Santhosh-Sellavel
Copy link
Collaborator

@mollfpr I've just tested a proposal there it's not working on this form.

@mollfpr bump

@mollfpr
Copy link
Contributor

mollfpr commented Nov 10, 2022

@Santhosh-Sellavel

#12400 (comment) in this test you using CompanyStep where we haven't refactored this form to use Form.js.

<ReimbursementAccountForm onSubmit={this.submit}>

onFixTheErrorsLinkPressed={() => {
this.form.scrollTo({y: 0, animated: true});
}}

While this #12400 issue happens in BankAccountManualStep where we use Form.js. You should try to test it in any form that uses Form.js.

<Form
formID={ONYXKEYS.FORMS.REIMBURSEMENT_ACCOUNT_FORM}
onSubmit={this.submit}
validate={this.validate}
submitButtonText={this.props.translate('common.saveAndContinue')}
style={[styles.mh5, styles.flexGrow1]}
>

App/src/components/Form.js

Lines 230 to 232 in 9e3a5ab

onFixTheErrorsLinkPressed={() => {
this.inputRefs[_.first(_.keys(this.state.errors))].focus();
}}

@Santhosh-Sellavel
Copy link
Collaborator

@mollfpr How to test this IdentityForm against the same issue, Should we have to wait until RequesterStep is complete?

@mollfpr
Copy link
Contributor

mollfpr commented Nov 10, 2022

@Santhosh-Sellavel IMO we shouldn't. This refactoring doesn't impact the inputRefs state of Form.js.

The current implementation of onFixTheErrorsLinkPressed is to get the input refs from the order of key in this.state.errors.

This issue #12400 occurred because on the validation function of BankAccountManualStep the first to validate is the accountNumber value. So that's why the focus input is the account number field. If we change the order of that validation the routingNumber is the first value to validate, the focus input will be correct to the routing number input.

validate(values) {
const errorFields = {};
const routingNumber = values.routingNumber && values.routingNumber.trim();
if (
!values.accountNumber
|| (!CONST.BANK_ACCOUNT.REGEX.US_ACCOUNT_NUMBER.test(values.accountNumber.trim()) && !CONST.BANK_ACCOUNT.REGEX.MASKED_US_ACCOUNT_NUMBER.test(values.accountNumber.trim()))
) {
errorFields.accountNumber = this.props.translate('bankAccount.error.accountNumber');
}
if (!routingNumber || !CONST.BANK_ACCOUNT.REGEX.SWIFT_BIC.test(routingNumber) || !ValidationUtils.isValidRoutingNumber(routingNumber)) {
errorFields.routingNumber = this.props.translate('bankAccount.error.routingNumber');
}
if (!values.acceptedTerms) {
errorFields.acceptedTerms = this.props.translate('common.error.acceptedTerms');
}
return errorFields;
}

It's already explained in this proposal.

@Santhosh-Sellavel
Copy link
Collaborator

@mollfpr I believe you miss understood, I'm not saying to put 12400 on hold until.

I am asking, to test this 'IdentityForm' we should wait until 'RequestorStep' to test whether this works as expected or not against the issue as we didn't complete RequesterStep which uses Identity Form.

@mollfpr
Copy link
Contributor

mollfpr commented Nov 10, 2022

@Santhosh-Sellavel Ahh sorry!

@Santhosh-Sellavel
Copy link
Collaborator

Santhosh-Sellavel commented Nov 10, 2022

@mollfpr So we have to wait right?

@mollfpr
Copy link
Contributor

mollfpr commented Nov 10, 2022

@Santhosh-Sellavel Let’s ask @neil-marcellini and @luacmartins

@neil-marcellini
Copy link
Contributor Author

My understanding is that to test a solution to this issue #12400, we need a form that uses IdentityForm. Is that indeed the problem in question? Could we use Storybook to test IdentityForm in isolation? If not then it sounds like we will have to hold #12400 on #9581.

@mollfpr
Copy link
Contributor

mollfpr commented Nov 11, 2022

I could create a storybook component for IdentityForm that use the Form.js but holding this until #9581 passed is a good idea.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Nov 16, 2022
@JmillsExpensify
Copy link

JmillsExpensify commented Nov 16, 2022

@Santhosh-Sellavel @neil-marcellini The regression period has passed. At this point, this PR is merged and IndentityForm is "done." What's our plan for testing this in conjunction with related issues? Should that happen in a separate issue when #12400 and #9581 are ready?

@Santhosh-Sellavel
Copy link
Collaborator

@JmillsExpensify When #9581 is ready, this should work!

@JmillsExpensify
Copy link

Ok, I'm going to go ahead and issue payment. Per the process, the PR is merged and has been for 7 days. I don't feel great about waiting on a related issue that is not yet merged. That part is on Expensify.

@JmillsExpensify JmillsExpensify added Weekly KSv2 and removed Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 labels Nov 17, 2022
@JmillsExpensify
Copy link

Alright, all contributors paid out. I removed the Awaiting Payment label and I'm also updating the hold as well. We can come back to this and test when #9581 is ready.

@JmillsExpensify JmillsExpensify changed the title [HOLD for payment 2022-11-16] [$500] IdentityForm [HOLD #9581] [$500] IdentityForm Nov 17, 2022
@JmillsExpensify
Copy link

Review of the linked/holding PR is in progress! I'll have to check back in the coming days.

@JmillsExpensify
Copy link

JmillsExpensify commented Nov 27, 2022

#9581 is merged and on staging at this point, so I think we should be able to remove the hold and move forward with next steps. Does that sound right @Santhosh-Sellavel @neil-marcellini?

@Santhosh-Sellavel
Copy link
Collaborator

We can close this now or along with #9581.This is already merged, we were waiting for test a particular test case which is passing now. @JmillsExpensify

@JmillsExpensify
Copy link

Awesome, sounds like a plan. As for regression tests, I think we are already covered via this test. Accordingly, I'm going to close. cc @luacmartins please re-open if you disagree and I'll make sure any additional cases are added to that existing test.

@JmillsExpensify JmillsExpensify changed the title [HOLD #9581] [$500] IdentityForm [$500] IdentityForm Nov 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Engineering External Added to denote the issue can be worked on by a contributor NewFeature Something to build that is a new item. Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

7 participants