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

[HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] [$500] Android - Bank Account - Connect bank account page blinks when navigate from Bills page #27901

Closed
1 of 6 tasks
lanitochka17 opened this issue Sep 20, 2023 · 52 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Sep 20, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Navigate to Workspace Editor
  2. Tap on Pay Bills
  3. Click on connect bank account

Expected Result:

User should be redirected to the Connect Bank Account page and none errors should appear

Actual Result:

Connect bank account page blinks when navigate from Bills page

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.72-6

Reproducible in staging?: Yes

Reproducible in production?: No

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

Notes/Photos/Videos: Any additional supporting documentation

Bug6208016_az_recorder_20230920_221803.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~011699c610be6cc9cd
  • Upwork Job ID: 1707628269307260928
  • Last Price Increase: 2023-10-10
  • Automatic offers:
    • honnamkuan | Contributor | 27123291
Issue OwnerCurrent Issue Owner: @rushatgabhane
@lanitochka17 lanitochka17 added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 20, 2023

Triggered auto assignment to @bfitzexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Sep 20, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@OSBotify
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.

@melvin-bot
Copy link

melvin-bot bot commented Sep 20, 2023

Auto-assign attempt failed, all eligible assignees are OOO.

@thienlnam
Copy link
Contributor

Let's fix this, but removing the blocker as it's a minor bug

@thienlnam thienlnam removed the DeployBlockerCash This issue or pull request should block deployment label Sep 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 21, 2023

Triggered auto assignment to @marcochavezf (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@ginsuma
Copy link
Contributor

ginsuma commented Sep 21, 2023

I cannot reproduce it.

@melvin-bot melvin-bot bot added the Overdue label Sep 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 2023

@marcochavezf, @bfitzexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@honnamkuan
Copy link
Contributor

honnamkuan commented Sep 25, 2023

Proposal

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

Reproducible on IOS and Android.

When user go to a Settings > Workspaces > Select workspace > "Bills" > Connect bank account..
"Connect bank account" is initially shown, then "loading indicator page", then shortly after "Connect bank account" is shown again.

Clicking Back once and the click on "Connect bank account" again will reproduce similar blinking problem, but it is actually caused by slightly different root cause.

What is the root cause of that problem?

Root Cause 1

When user is initially signed in, reimbursementAccount Onyx key is not set.

Then he open up the workspace "Bills" page, there is an read API call "OpenWorkspaceView", which set Onyx reimbursementAccount like so:

[
  {
    "onyxMethod": "merge",
    "key": "reimbursementAccount",
    "value": {
      "achData": {
        "state": ""
      }
    }
  }
]

This causes the ReimbursementAccountPage to mistakenly considered that OpenReimbursementAccountPage API call has been completed when it hasn't run, because current code set state.hasACHDataBeenLoaded: true, by comparing props.reimbursementAccount against defaultProps

const hasACHDataBeenLoaded = this.props.reimbursementAccount !== ReimbursementAccountProps.reimbursementAccountDefaultProps;

That makes the "Connect bank account" screen to initially show up.

Shortly afterwards, when componentDidMount runs and fetchData>BankAccounts.openReimbursementAccountPage is called, optimisticData set this.props.reimbursementAccount.isLoading: true, and loading indicator page is shown.

A moment later, when OpenReimbursementAccountPage API call actually completed, successData set this.props.reimbursementAccount.isLoading: false, then "Connect bank account" is shown again. Hence the screen blinking.

--

Root Cause 2

Now when user click on back once and then click on "Connect bank account" again, similar blinking happens, but the rootcause this time is slightly different.

When back is clicked, user is routed back to "Bills" page, however this time the reimbursementAccount Onyx key is actually set, because we never clear it.
When user click on "Connect bank account" button again, ReimbursementAccountPage code set state.hasACHDataBeenLoaded: true because reimbursementAccount from backend is found in Onyx, but as componentDidMount still runs, it will again run fetchData>BankAccounts.openReimbursementAccountPage is called, optimisticData set this.props.reimbursementAccount.isLoading: true, and then successData set it back to false when API completes. So the blinking still happens.

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

Modify ReimbursementAccountPage

(1). Update the logic to set hasACHDataBeenLoaded from current implementation

const hasACHDataBeenLoaded = this.props.reimbursementAccount !== ReimbursementAccountProps.reimbursementAccountDefaultProps;

to

        const hasACHDataBeenLoaded =
            _.has(this.props.reimbursementAccount, 'achData.currentStep') && this.props.reimbursementAccount !== ReimbursementAccountProps.reimbursementAccountDefaultProps;

so that it can identify ACH Data to be loaded only when 'achData.currentStep' that is returned from OpenReimbursementAccountPage API call can be found in Onyx store.

(2). add componentWillUnmount react lifecycle function to call BankAccounts.clearReimbursementAccount();
so that ONYXKEYS.REIMBURSEMENT_ACCOUNT is cleared on component unmount, and get populated on componentDidMount
That will resolve the blinking issue occurs when user click back and then click "Connect bank account" again, and also makes data stored in Onyx cleaner.

What alternative solutions did you explore? (Optional)

We can consider changing "OpenWorkspaceView" backend API response to returns the full reimbursementAccount Onyx object (similar to OpenReimbursementAccountPage API), if we do that then we do no need the proposed change (1), but (2) is still needed.

Other than that, I have also considered the option to not always call fetchData on componentDidMount if it is already available in Onyx store, that might resolve Root Cause 2, but not preferable because it might results in stale data being used.

@bfitzexpensify
Copy link
Contributor

@marcochavezf is this something we need to handle internally or can it be worked on by contributors?

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Sep 25, 2023
@bfitzexpensify
Copy link
Contributor

Bump on #27901 (comment) @marcochavezf

@melvin-bot melvin-bot bot removed the Overdue label Sep 28, 2023
@marcochavezf
Copy link
Contributor

Hmm interesting and thanks for the analysis @honnamkuan, yeah this looks like it should be fixed internally. Applying the label

@JmillsExpensify
Copy link

$750 payment approved for @rushatgabhane based on summary above.

@bfitzexpensify
Copy link
Contributor

Thanks for detailed explanation @hoangzinh.

Of those two behaviours, I think this makes sense to me:

If no, we should remove the workspace bank account's error out of an RBR in the user avatar. link to code

@bfitzexpensify
Copy link
Contributor

Also a reminder to complete the BZ checklist here @rushatgabhane

@bfitzexpensify
Copy link
Contributor

Bump on the BZ checklist @rushatgabhane - thank you!

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 31, 2023

@honnamkuan, @marcochavezf, @rushatgabhane, @bfitzexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

@bfitzexpensify
Copy link
Contributor

@rushatgabhane another bump on the BZ checklist, thank you

Copy link

melvin-bot bot commented Nov 6, 2023

@honnamkuan, @marcochavezf, @rushatgabhane, @bfitzexpensify Huh... This is 4 days overdue. Who can take care of this?

@bfitzexpensify
Copy link
Contributor

Just waiting on BZ checklist here, Melv

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Nov 7, 2023
@marcochavezf
Copy link
Contributor

Friendly bump @rushatgabhane

Copy link

melvin-bot bot commented Nov 10, 2023

@honnamkuan, @marcochavezf, @rushatgabhane, @bfitzexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

Copy link

melvin-bot bot commented Nov 10, 2023

@honnamkuan, @marcochavezf, @rushatgabhane, @bfitzexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

@rushatgabhane
Copy link
Member

rushatgabhane commented Nov 14, 2023

  1. The PR that introduced the bug has been identified. Link to the PR: N.A.

  2. The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment: N.A.

  3. A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion: N.A.

  4. Determine if we should create a regression test for this bug. N.A.

  5. If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again
    N.A.

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Nov 14, 2023
@rushatgabhane
Copy link
Member

rushatgabhane commented Nov 17, 2023

@bfitzexpensify this bug exists since Bank Account flow was first implemented (years ago). It's difficult to point out a PR and not so much useful.

@bfitzexpensify
Copy link
Contributor

Cool that makes sense. Let's close this one out then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

10 participants