Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.53k stars 2.88k forks source link

[HOLD for Payment 2024-10-08][$250] Bank account - Double RHP animation when clicking on "connect bank accont" #49503

Closed IuliiaHerets closed 3 weeks ago

IuliiaHerets commented 1 month ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.38-0 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): applausetester+nl620@applause.expensifail.com Issue reported by: Applause Internal Team

Action Performed:

  1. Navigate to staging.new.expensify.com with an Expensifail account
  2. Create a workspace and enable workflows
  3. Go to workflow
  4. Click on connect to bank account

    Expected Result:

    RHP animation gets shown only once

Actual Result:

RHP animation gets shown twice

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/460b2250-0e3a-436e-afff-623470302a58

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021837132579404847952
  • Upwork Job ID: 1837132579404847952
  • Last Price Increase: 2024-09-20
melvin-bot[bot] commented 1 month ago

Triggered auto assignment to @garrettmknight (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

IuliiaHerets commented 1 month ago

@garrettmknight FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

Krishna2323 commented 1 month ago

Proposal


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

Bank account - Double RHP animation when clicking on "connect bank accont"

What is the root cause of that problem?

https://github.com/Expensify/App/blob/25450d96aca5d30b0fef7bdbfc9379fa71e7cd74/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx#L218 https://github.com/Expensify/App/blob/25450d96aca5d30b0fef7bdbfc9379fa71e7cd74/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx#L312-L322

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


We should prevent calling the navigation in the useEffect if the backTo route is backTo === ROUTES.WORKSPACE_WORKFLOWS.getRoute(policyID ?? '')

What alternative solutions did you explore? (Optional)

Result

nkdengineer commented 1 month ago

Proposal

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

RHP animation gets shown twice

What is the root cause of that problem?

After we navigate to the route BANK_ACCOUNT_WITH_STEP_TO_OPEN here, we are setting stepToOpen to an empty string. Then, we navigate a second time with stepToOpen set to getRouteForCurrentStep(currentStep) in this useEffect, which causes a double RHP animation.

https://github.com/Expensify/App/blob/25450d96aca5d30b0fef7bdbfc9379fa71e7cd74/src/libs/actions/ReimbursementAccount/navigation.ts#L20-L22

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

We should modify stepToOpen when we call the navigateToBankAccountRoute function, and I think it should default to ROUTE_NAMES.NEW as we are doing here.

function navigateToBankAccountRoute(policyID: string, backTo?: string) {
    Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute(ROUTE_NAMES.NEW, policyID, backTo));
}

https://github.com/Expensify/App/blob/25450d96aca5d30b0fef7bdbfc9379fa71e7cd74/src/libs/actions/ReimbursementAccount/navigation.ts#L20-L22

What alternative solutions did you explore? (Optional)

cretadn22 commented 1 month ago

Proposal

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

Double RHP animation when clicking on "connect bank account"

What is the root cause of that problem?

On the Workflow page, we navigate to the ReimbursementAccountPage with an empty string for stepToOpen.

https://github.com/Expensify/App/blob/25450d96aca5d30b0fef7bdbfc9379fa71e7cd74/src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx#L236

Then, another navigation is triggered here because the currentStep in Onyx and the step in the route are different.

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

In the navigateToBankAccountRoute function, we introduced a new parameter stepToOpen

https://github.com/Expensify/App/blob/25450d96aca5d30b0fef7bdbfc9379fa71e7cd74/src/libs/actions/ReimbursementAccount/navigation.ts#L20

function navigateToBankAccountRoute(stepToOpen: string, policyID: string, backTo?: string) {
    Navigation.navigate(ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute(stepToOpen ?? '', policyID, backTo));
}

we pass stepToOpen as ROUTE_NAMES.NEW here, we also need to update other areas that use this function.

Or even we could eliminate the navigateToBankAccountRoute function and use Navigation.navigate directly with the correct params

What alternative solutions did you explore? (Optional)

melvin-bot[bot] commented 1 month ago

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

melvin-bot[bot] commented 1 month ago

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

melvin-bot[bot] commented 1 month ago

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

bernhardoj commented 1 month ago

Proposal

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

The connect bank account page slide animation isn't smooth.

What is the root cause of that problem?

On the bank account page, we have a navigation code that will be called whenever the step is changed. https://github.com/Expensify/App/blob/a7a408fb0e6a01ebbe52831e468a8e3d310e4dbd/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx#L322

When we open the bank account page, the step is initially empty and will be updated to /new which is mapped to BankAccountStep that shows whether to connect manually or with Plaid. If there is an existing progress, then the step won't be updated to /new.

The navigation code is there to update the step params of the bank account page.

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

Instead of using navigate to update the params, we can use setParams.

Navigation.setParams({stepToOpen: getRouteForCurrentStep(currentStep)});
mollfpr commented 1 month ago

We should prevent calling the navigation in the useEffect if the backTo route is backTo === ROUTES.WORKSPACE_WORKFLOWS.getRoute(policyID ?? '')

@Krishna2323 The comparison doesn't make sense to me, we could have different backTo values in the future.


We should modify stepToOpen when we call the navigateToBankAccountRoute function, and I think it should default to ROUTE_NAMES.NEW as we are doing here.

@nkdengineer When the user navigates to connect a bank account it shows the continue setup or start over, there's no step decided yet, so it makes sense to start with an empty string.

@cretadn22 It Seems your solution is similar but has a different implementation.


I think the proposal from @bernhardoj makes sense here and the double animation is not happening. We still have the correct route set up.

🎀 👀 🎀 C+ reviewed!

melvin-bot[bot] commented 1 month ago

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

dangrous commented 1 month ago

Works for me!

bernhardoj commented 1 month ago

PR is ready

cc: @mollfpr

garrettmknight commented 1 month ago

PR is on staging

dangrous commented 1 month ago

on prod 14 hours ago. Is there like a serious issue with automations right now?

EDIT: yes, but it's being fixed!

garrettmknight commented 1 month ago

Payment Summary:

garrettmknight commented 1 month ago

@mollfpr can you complete the checklist please?

garrettmknight commented 1 month ago

Not overdue?

bernhardoj commented 1 month ago

Requested in ND.

mollfpr commented 1 month ago

[@mollfpr] The PR that introduced the bug has been identified. Link to the PR: [@mollfpr] 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:

I couldn't determine the offending PR.

[@mollfpr] 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:

The regression step should be enough.

[@mollfpr] Determine if we should create a regression test for this bug. [@mollfpr] 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.

  1. Open a workspace and enable workflows (if disabled)
  2. Go to workflow
  3. Click on connect to bank account
  4. Verify there is no double RHP slide animation
  5. 👍 or 👎
JmillsExpensify commented 1 month ago

Confirming this is the correct payment summary:

mallenexpensify commented 1 month ago

@garrettmknight , for auditing purposes, so that we know if a contributor is paid/due and where they've been paid, can you use the below format, as per the main payment SO

Contributor: @ paid $ via Upwork Contributor+: @ due $ via NewDot

Thx

garrettmknight commented 3 weeks ago

$250 approved for @mollfpr

JmillsExpensify commented 3 weeks ago

$250 approved for @bernhardoj based on this summary.