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.51k stars 2.87k forks source link

Company Cards - Bank name persists between different banks in the Other card feed #51860

Open lanitochka17 opened 2 hours ago

lanitochka17 commented 2 hours 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.56-2 Reproducible in staging?: Y Reproducible in production?: N If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Issue reported by: Applause - Internal Team

Issue found when executing PR https://github.com/Expensify/App/pull/51569

Action Performed:

  1. Open the app
  2. Log in with an expensify account that's an admin of a workspace with "Company Cards" enabled
  3. Navigate to Workspace settings - Company cards
  4. Navigate to Add company cards - Other - Mastercard Commercial Cards - Next
  5. Enter any text for the "Name of bank"
  6. Tap on the "Next" button
  7. Navigate back to the screen where "Mastercard Commercial Cards" and "Visa Commercial Cards" are visible
  8. Tap on "Visa Commercial Cards" - Next - Next

Expected Result:

Bank name should be cleared when choosing a different bank

Actual Result:

Bank name persists between different banks in the "Other" card feed

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/95657f08-25c7-4616-9413-7f8570b65f13

View all open jobs on GitHub

melvin-bot[bot] commented 2 hours ago

Triggered auto assignment to @JmillsExpensify (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.

melvin-bot[bot] commented 2 hours ago

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

melvin-bot[bot] commented 2 hours ago

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

github-actions[bot] commented 2 hours ago

:wave: 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 commented 2 hours ago

We think that this bug might be related to #wave-collect - Release 2

MuaazArshad commented 2 hours ago

Edited by proposal-police: This proposal was edited at 2024-11-01 15:22:42 UTC.

Proposal

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

Bank name persists between different banks in the Other card feed.

What is the root cause of that problem?

After we click next the bank name is saved then we are setting the default value of the bank name here https://github.com/Expensify/App/blob/bfce2771d22cbecceee6cf3c064fe3f0627eb5d8/src/pages/workspace/companyCards/addNew/CardNameStep.tsx#L68

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

We should reset the value of the bank name when navigating back.

CompanyCards.setAddNewCompanyCardStepAndData({
            data: {
                bankName: '',
            },
            isEditing: false,
        });

What alternative solutions did you explore? (Optional)

Nodebrute commented 1 hour ago

Proposal

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

Bank name persists between different banks in the Other card feed

What is the root cause of that problem?

When the user enters the name of the card, it is stored in Onyx. https://github.com/Expensify/App/blob/bfce2771d22cbecceee6cf3c064fe3f0627eb5d8/src/pages/workspace/companyCards/addNew/CardNameStep.tsx#L33 However, when we go back and select another card type, only the feedType is changed, while the name remains unchanged. https://github.com/Expensify/App/blob/bfce2771d22cbecceee6cf3c064fe3f0627eb5d8/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx#L100-L104

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

We should also reset the name when the user selects a different card type. By implementing this, we preserve the name if the user selects the same card type while ensuring that the name is set to null if a different card type is chosen.

data: {
                    feedType: typeSelected,
                    ...(typeSelected !== addNewCard?.data.feedType && { bankName: null })
                },

https://github.com/Expensify/App/blob/bfce2771d22cbecceee6cf3c064fe3f0627eb5d8/src/pages/workspace/companyCards/addNew/CardTypeStep.tsx#L100-L104

What alternative solutions did you explore? (Optional)