Skip to content

[HOLD for payment 2024-02-14] [$500] Request Money - Previous currency is shown selected if edit Amount&Currency in Request Money #33608

Closed

Description

@kbecciv

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: 1.4.17-1
Reproducible in staging?: y
Reproducible in production?: y
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
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Login to ND Expensify
  2. Tap FAB button
  3. Tap Request money
  4. Select Manual tab
  5. Select a currency and enter any amount
  6. Tap Next
  7. Select an attandee
  8. When in final review page, click on Amount field to edit
  9. Click on Currency and change to another one
  10. Again click on Currency and verify if new selected currency is shown

Expected Result:

Last selected currency should be shown while editing Request Money

Actual Result:

Previous currency is shown selected if user changes it while editing Request Money

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

image

Bug6326315_1703614106567.2023-12-26_20-14-43.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0137f820b6bde4b24a
  • Upwork Job ID: 1739718074911305728
  • Last Price Increase: 2023-12-26
  • Automatic offers:
    • hoangzinh | Reviewer | 28076604
    • shubham1206agra | Contributor | 28076605

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 26, 2023
  2. melvin-bot commented on Dec 26, 2023

    @melvin-bot
  3. changed the title [-]Request Money - Previous currency is shown selected if edit Amount&Currency in Request Money[/-] [+][$500] Request Money - Previous currency is shown selected if edit Amount&Currency in Request Money[/+] on Dec 26, 2023
  4. melvin-bot commented on Dec 26, 2023

    @melvin-bot

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

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 26, 2023
  6. melvin-bot commented on Dec 26, 2023

    @melvin-bot

    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
  7. melvin-bot commented on Dec 26, 2023

    @melvin-bot

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

  8. FitseTLT commented on Dec 26, 2023

    @FitseTLT
    Contributor

    Proposal

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

    Request Money - Previous currency is shown selected if edit Amount&Currency in Request Money

    What is the root cause of that problem?

    We are not updating draft transaction when the pageindex is confirm here

    if (pageIndex !== 'confirm') {
    IOU.setMoneyRequestCurrency_temporaryForRefactor(transactionID, option.currencyCode);
    }

    from this pr to avoid the saving of the currency on transaction when the user just navigates back after changing the currency without pressing save.

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

    Use the same mechnism we used in IOURequestStepAmount and give the current currency in the route by naviagting with currency param here

    const navigateToCurrencySelectionPage = () => {
    Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CURRENCY.getRoute(iouType, transactionID, reportID, backTo ? 'confirm' : '', Navigation.getActiveRouteWithoutParams()));
    };

    to

    const navigateToCurrencySelectionPage = () => {
            Navigation.navigate(
                `${ROUTES.MONEY_REQUEST_STEP_CURRENCY.getRoute(iouType, transactionID, reportID, backTo ? 'confirm' : '', Navigation.getActiveRouteWithoutParams())}&currency=${currency}`,
            );
        };
    

    Inside IOURequestStepCurrency

        const currency = pageIndex === 'confirm' ? currencyFromRoute : transactionCurrency;
    
    

    What alternative solutions did you explore? (Optional)

  9. shubham1206agra commented on Dec 26, 2023

    @shubham1206agra
    Contributor

    Proposal

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

    Request Money - Previous currency is shown selected if edit Amount&Currency in Request Money

    What is the root cause of that problem?

    This PR #32826 prohibits the change in currency in transaction draft when on confirm page.

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

    Add new property originalCurrency, and use it to restore the currency on pressing on back button only. And let IOU.setMoneyRequestCurrency_temporaryForRefactor(transactionID, option.currencyCode); run unconditionally

    Explaination

    This works by creating a field inside transaction draft onyx structure named original currency

    /**
     * @param {String} transactionID
     * @param {String} originalCurrency
     */
    function setMoneyRequestOriginalCurrency_temporaryForRefactor(transactionID, originalCurrency) {
        Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, {originalCurrency});
    }

    And use this method on mount method of IOURequestStepAmount component, since this is the only place from where we can change currency.

    And then restore the currency if save method was never hit on this step during unmount method

    What alternative solutions did you explore? (Optional)

  10. namhihi237 commented on Dec 26, 2023

    @namhihi237
    Contributor

    Proposal

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

    Currency is not updated when edit

    What is the root cause of that problem?

    Currently, we get currency from the draft transaction, When we select from the list we don't save anywhere when slect row until we save on the IOURequestStepAmount screen.

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

    We should pass the query current currency from IOURequestStepAmount when open IOURequestStepCurrency to show the currency selected before. We will priority show currency from url first and then the draft

    What alternative solutions did you explore? (Optional)

    N/A

  11. dukenv0307 commented on Dec 27, 2023

    @dukenv0307
    Contributor

    Proposal

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

    Previous currency is shown selected if user changes it while editing Request Money

    What is the root cause of that problem?

    The selected currency is displayed as the currency which we stored in transaction. When we select a currency and the pageIndex is confirm we don't store this in transaction. So when we go to this page again, the selected currency is still the previous currency

    if (pageIndex !== 'confirm') {

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

    We don't store this to transaction to avoid the case the user just goes back to confirm page without saving. We can remove this condition to always store to selected currency in transaction

    Keyboard.dismiss();
    IOU.setMoneyRequestCurrency_temporaryForRefactor(transactionID, option.currencyCode);
    navigateBack(option.currencyCode);
    

    if (pageIndex !== 'confirm') {

    And then on IOURequestStepAmount page, we can create a useEffect to restore the currency if this page is unmounted without saving

    1. Create a ref to know the amount is saved or not
    const isSavedAmountAndCurrency = useRef(false);
    
    1. Update this to true in navigateToNextPage
    isSavedAmountAndCurrency.current = true;
    

    const navigateToNextPage = ({amount}) => {

    1. Create a useEffect to restore the currency
    useEffect(() => {
        return () => {
            if (isSavedAmountAndCurrency.current) {
                return;
            }
            IOU.setMoneyRequestCurrency_temporaryForRefactor(transactionID, originalCurrency);
        }
    }, [])
    

    What alternative solutions did you explore? (Optional)

    NA

  12. 58 remaining items

  13. melvin-bot commented on Feb 6, 2024

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  14. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Feb 7, 2024
  15. changed the title [-][$500] Request Money - Previous currency is shown selected if edit Amount&Currency in Request Money[/-] [+][HOLD for payment 2024-02-14] [$500] Request Money - Previous currency is shown selected if edit Amount&Currency in Request Money[/+] on Feb 7, 2024
  16. melvin-bot commented on Feb 7, 2024

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  17. melvin-bot commented on Feb 7, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.37-7 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 2024-02-14. 🎊

    For reference, here are some details about the assignees on this issue:

  18. melvin-bot commented on Feb 7, 2024

    @melvin-bot

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@hoangzinh / @shubham1206agra] The PR that introduced the bug has been identified. Link to the PR:
    • [@hoangzinh / @shubham1206agra] 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:
    • [@hoangzinh / @shubham1206agra] 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:
    • [@hoangzinh / @shubham1206agra] Determine if we should create a regression test for this bug.
    • [@hoangzinh / @shubham1206agra] 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.
    • [@bfitzexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  19. bfitzexpensify commented on Feb 14, 2024

    @bfitzexpensify
    Contributor

    Payments complete, @hoangzinh please complete the BZ checklist when you get a moment - thanks!

  20. hoangzinh commented on Feb 15, 2024

    @hoangzinh
    Contributor

    BugZero Checklist:

    Regression Test Proposal

    1. Login to ND Expensify
    2. Tap FAB button
    3. Tap Request money
    4. Select Manual tab
    5. Enter any amount
    6. Tap Next
    7. Select any participant
    8. When on the confirmation page, tap Amount field to edit
    9. Tap on Currency and change to another one
    10. Tap again on Currency
    11. Verify that the new selected currency in step 9 is shown selected

    Do we agree 👍 or 👎

  21. bfitzexpensify commented on Feb 16, 2024

    @bfitzexpensify
    Contributor

    Thanks @hoangzinh. Agree with those regression steps - added via https://github.com/Expensify/Expensify/issues/370147.

    Let's close this one out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions