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

[$250] Wallet - Check Box is unselected when changing Account Type #55688

Open
1 of 8 tasks
lanitochka17 opened this issue Jan 23, 2025 · 18 comments
Open
1 of 8 tasks

[$250] Wallet - Check Box is unselected when changing Account Type #55688

lanitochka17 opened this issue Jan 23, 2025 · 18 comments
Assignees
Labels
Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Jan 23, 2025

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: 9.0.89-2
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: #54798
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to Account settings > Wallet
  3. Click Add bank account
  4. Select any country other than US
  5. Enter info and reach confirmation page
  6. On confirmation page, Select the terms checkbox
  7. Click the account type selector row
  8. Change the account type and Confirm

Expected Result:

The checkbox should remain selected after changing account type

Actual Result:

The checkbox is unselected after changing account type

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6722248_1737672192939.Screen_Recording_2025-01-24_at_1.37.24_at_night.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021882570613169902798
  • Upwork Job ID: 1882570613169902798
  • Last Price Increase: 2025-01-30
  • Automatic offers:
    • dominictb | Reviewer | 106014247
    • mkzie2 | Contributor | 106014248
Issue OwnerCurrent Issue Owner: @dominictb
@lanitochka17 lanitochka17 added the DeployBlockerCash This issue or pull request should block deployment label Jan 23, 2025
Copy link

melvin-bot bot commented Jan 23, 2025

Triggered auto assignment to @cead22 (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented Jan 23, 2025

💬 A slack conversation has been started in #expensify-open-source

Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@lanitochka17
Copy link
Author

Different behavior on prod (bank account flow)

bandicam.2025-01-24.02-13-31-549.mp4

@cead22 cead22 added Daily KSv2 External Added to denote the issue can be worked on by a contributor and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Jan 23, 2025
Copy link

melvin-bot bot commented Jan 23, 2025

Job added to Upwork: https://www.upwork.com/jobs/~021882570613169902798

@melvin-bot melvin-bot bot changed the title Wallet - Check Box is unselected when changing Account Type [$250] Wallet - Check Box is unselected when changing Account Type Jan 23, 2025
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 23, 2025
Copy link

melvin-bot bot commented Jan 23, 2025

Triggered auto assignment to Contributor-plus team member for initial proposal review - @dominictb (External)

@Shahidullah-Muffakir
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

When user changes account types the check box for Terms of service gets unchecked

What is the root cause of that problem?

We are not considering the default condition for the toggle to be checked based on the formValues here:

<InputWrapper
InputComponent={CheckboxWithLabel}
aria-label={`${translate('common.iAcceptThe')} ${translate('common.addCardTermsOfService')}`}
inputID="acceptTerms"
LabelComponent={TermsAndConditionsLabel}
style={[styles.mt3]}

What changes do you think we should make in order to solve the problem?

Add default value to it based on the form filled values by passing this prop to the InputWrapper:

   defaultValue={!!formValues.acceptTerms}

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

NA

What alternative solutions did you explore? (Optional)

NA

Screen.Recording.2025-01-24.at.5.48.21.AM.mov

@mkzie2
Copy link
Contributor

mkzie2 commented Jan 24, 2025

Proposal

Please re-state the problem that we are trying to solve in this issue.

The checkbox is unselected after changing account type

What is the root cause of that problem?

The confirmation step is unmounted when we go to the account type step. The account type step doesn't use FormProvider and when we merge the value we call setDraftValues which will merge the value to the draft form. While the value is merging, the confirmation step is rendered again, and in FormProvider, the draftValues is undefinfed the first time rendered (see the log below for more detail) then the acceptTerms is an empty string when we register the input.

setDraftValues(ONYXKEYS.FORMS.INTERNATIONAL_BANK_ACCOUNT_FORM, {[CONST.CORPAY_FIELDS.ACCOUNT_TYPE_KEY]: currentAccountType});

Image

The reason it's an empty string instead of false is because we don't pass the valueType to InputWrapper then it's initialized as an empty string by getInitialValueByType function

inputValues[inputID] = inputProps.defaultValue ?? getInitialValueByType(inputProps.valueType);

What changes do you think we should make in order to solve the problem?

We have two options to fix this issue

  1. We should only call onNext until the merge value is completed. We can return a promise in setDraftValues function and call the onNext in this promise
function setDraftValues(formID: OnyxFormKey, draftValues: NullishDeep<OnyxValue<OnyxFormDraftKey>>) {
    return Onyx.merge(`${formID}Draft`, draftValues ?? null);
}

setDraftValues(ONYXKEYS.FORMS.INTERNATIONAL_BANK_ACCOUNT_FORM, {[CONST.CORPAY_FIELDS.ACCOUNT_TYPE_KEY]: currentAccountType}).then(() => {
    onNext();
});

setDraftValues(ONYXKEYS.FORMS.INTERNATIONAL_BANK_ACCOUNT_FORM, {[CONST.CORPAY_FIELDS.ACCOUNT_TYPE_KEY]: currentAccountType});

  1. Use FormProvider in AccountType step. That will require some migration. We can use the same way in TypeBusiness

Using defaultValue from formValues can work because formValues is passed from the InternationalDepositAccount that isn't unmounted in this flow. But I think it doesn't fix the RCA of this issue.

Optional: We can add valueType prop as boolean to the InputWrapper of the checkbox then this value can be initialized correctly.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

NA

What alternative solutions did you explore? (Optional)

NA

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

Copy link

melvin-bot bot commented Jan 27, 2025

@cead22, @dominictb Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Jan 27, 2025
Copy link

melvin-bot bot commented Jan 29, 2025

@cead22, @dominictb Eep! 4 days overdue now. Issues have feelings too...

@cead22
Copy link
Contributor

cead22 commented Jan 30, 2025

Waiting for proposal reviews

@melvin-bot melvin-bot bot removed the Overdue label Jan 30, 2025
Copy link

melvin-bot bot commented Jan 30, 2025

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@dominictb
Copy link
Contributor

  1. Use FormProvider in AccountType step. That will require some migration. We can use the same way in TypeBusiness

@mkzie2 provided correct RCA. Let's go with this solution to follow our form convention.

LGTM 🎀👀🎀

Copy link

melvin-bot bot commented Feb 2, 2025

Current assignee @cead22 is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

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

melvin-bot bot commented Feb 5, 2025

📣 @dominictb 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Feb 5, 2025

📣 @mkzie2 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

Copy link

melvin-bot bot commented Feb 6, 2025

@cead22, @dominictb, @mkzie2 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 Overdue labels Feb 6, 2025
@mkzie2
Copy link
Contributor

mkzie2 commented Feb 6, 2025

@dominictb The PR is ready for review.

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 Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

5 participants