Skip to content

[HOLD for payment 2024-04-25] [$250] Remove IOUCurrencySelection.js and copy any changes since Nov 27 into IOURequestStepCurrency.js #34607

Closed

Description

@tgolen

This is a part of #29107. You can look at that issue for more context behind the cleanup process.

Problem

The app has two redundant components:

Old Component: IOUCurrencySelection
New Component IOURequestStepCurrency

Solution

Following the examples (example 1, example 2), the Old Component needs to be completely removed from the codebase

  1. Look at the history of the Old Component
  2. If there are any changes since Nov 27, 2023 which have not been added to the New Component, copy those changes
  3. Replace all uses of the Old Component with the New Component
  4. Remove all traces of Old Component
  5. Be sure to update all routes and navigation to use the new :action param (instead of being hard-coded with "create")
  6. Update any logic like isEditing to use the new action param from the route
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0107fbe87259b2ef2c
  • Upwork Job ID: 1747632778655997952
  • Last Price Increase: 2024-01-24
  • Automatic offers:
    • akinwale | Reviewer | 28119949
    • ZhenjaHorbach | Contributor | 28119950
Issue OwnerCurrent Issue Owner: @sakluger

Activity

  1. added
    Help WantedApply this label when an issue is open to proposals by contributors
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 16, 2024
  2. melvin-bot commented on Jan 16, 2024

    @melvin-bot

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

  3. ZhenjaHorbach commented on Jan 16, 2024

    @ZhenjaHorbach
    Contributor

    Proposal

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

    Remove IOUCurrencySelection.js and copy any changes since Nov 27 into IOURequestStepCurrency.js

    What is the root cause of that problem?

    This is not a bug. This is a part of #29107

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

    To make this ticket we need

    1. Check history IOUCurrencySelection

    https://github.com/Expensify/App/commits/main/src/pages/iou/IOUCurrencySelection.js?since=2023-11-25&until=2024-01-15

    Here we have a few changes
    But judging by the new component IOURequestStepCurrency
    These changes are not entirely relevant because we don't have useEffect unlike Old component

    useEffect(() => {
    // Do not dismiss the modal, when it is not the edit flow.
    if (!threadReportID) {
    return;
    }
    const report = ReportUtils.getReport(threadReportID);
    const parentReportAction = ReportActionsUtils.getReportAction(report.parentReportID, report.parentReportActionID);
    // Do not dismiss the modal, when a current user can edit this currency of this money request.
    if (ReportUtils.canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.CURRENCY)) {
    return;
    }
    // Dismiss the modal when a current user cannot edit a money request.
    Navigation.isNavigationReady().then(() => {
    Navigation.dismissModal();
    });
    }, [threadReportID]);

    BUT in Old component, we added useEffect in October which is not used in IOURequestStepCurrency
    and if I understand correctly
    We need to add this useEffect in New component to use other routes ( For example SCREENS.EDIT_REQUEST.CURRENCY)

    [SCREENS.EDIT_REQUEST.CURRENCY]: () => require('../../../pages/iou/IOUCurrencySelection').default as React.ComponentType,

    1. Make the necessary changes to the new component

    Add useEffect from old component to new (We need this component to use other routes ( For example SCREENS.EDIT_REQUEST.CURRENCY) )

    useEffect(() => {
    // Do not dismiss the modal, when it is not the edit flow.
    if (!threadReportID) {
    return;
    }
    const report = ReportUtils.getReport(threadReportID);
    const parentReportAction = ReportActionsUtils.getReportAction(report.parentReportID, report.parentReportActionID);
    // Do not dismiss the modal, when a current user can edit this currency of this money request.
    if (ReportUtils.canEditFieldOfMoneyRequest(parentReportAction, CONST.EDIT_REQUEST_FIELD.CURRENCY)) {
    return;
    }
    // Dismiss the modal when a current user cannot edit a money request.
    Navigation.isNavigationReady().then(() => {
    Navigation.dismissModal();
    });
    }, [threadReportID]);

    Why SCREENS.EDIT_REQUEST.CURRENCY?

    UseEffect expects to receive threadReportID from params from navigation

    if (!threadReportID) {
    return;
    }

    And **SCREENS.EDIT_REQUEST.CURRENCY** this is the only place where we use this parameter

    App/src/ROUTES.ts

    Lines 171 to 174 in 7c8336b

    EDIT_CURRENCY_REQUEST: {
    route: 'r/:threadReportID/edit/currency',
    getRoute: (threadReportID: string, currency: string, backTo: string) => `r/${threadReportID}/edit/currency?currency=${currency}&backTo=${backTo}` as const,
    },

    1. Update routes

    Old component are used in several places. Therefore, we need to make sure that everything is updated (And check that the new component works correctly) and does not cause any regression

    [SCREENS.MONEY_REQUEST.CURRENCY]: () => require('../../../pages/iou/IOUCurrencySelection').default as React.ComponentType,

    [SCREENS.SPLIT_DETAILS.EDIT_CURRENCY]: () => require('../../../pages/iou/IOUCurrencySelection').default as React.ComponentType,

    [SCREENS.EDIT_REQUEST.CURRENCY]: () => require('../../../pages/iou/IOUCurrencySelection').default as React.ComponentType,

    What alternative solutions did you explore? (Optional)

    NA

  4. njmulsqb commented on Jan 17, 2024

    @njmulsqb

    I would love to take this!

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jan 17, 2024
  6. changed the title [-]Remove IOUCurrencySelection.js and copy any changes since Nov 27 into IOURequestStepCurrency.js[/-] [+][$500] Remove IOUCurrencySelection.js and copy any changes since Nov 27 into IOURequestStepCurrency.js[/+] on Jan 17, 2024
  7. melvin-bot commented on Jan 17, 2024

    @melvin-bot
  8. melvin-bot commented on Jan 17, 2024

    @melvin-bot

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

  9. ishpaul777 commented on Jan 17, 2024

    @ishpaul777
  10. 37 remaining items

  11. self-assigned this
    on Apr 10, 2024
  12. changed the title [-][HOLD #35833][$250] Remove IOUCurrencySelection.js and copy any changes since Nov 27 into IOURequestStepCurrency.js[/-] [+][$250] Remove IOUCurrencySelection.js and copy any changes since Nov 27 into IOURequestStepCurrency.js[/+] on Apr 10, 2024
  13. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Apr 18, 2024
  14. changed the title [-][$250] Remove IOUCurrencySelection.js and copy any changes since Nov 27 into IOURequestStepCurrency.js[/-] [+][HOLD for payment 2024-04-25] [$250] Remove IOUCurrencySelection.js and copy any changes since Nov 27 into IOURequestStepCurrency.js[/+] on Apr 18, 2024
  15. melvin-bot commented on Apr 18, 2024

    @melvin-bot

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

  16. melvin-bot commented on Apr 18, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.62-17 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-04-25. 🎊

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

  17. melvin-bot commented on Apr 18, 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:

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

    @mountiny
    Contributor

    $250 to @akinwale and to @ZhenjaHorbach

  19. sakluger commented on Apr 26, 2024

    @sakluger
    Contributor

    All paid up! I don't think any new regression steps are needed since this is part of a larger project.

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