Skip to content

[HOLD for payment 2024-04-15] [$250] Remove NewRequestAmountPage.js and copy any changes since Nov 27 into IOURequestStepAmount.js #34614

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: NewRequestAmountPage
New Component IOURequestStepAmount

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/~01400d372c60004a9e
  • Upwork Job ID: 1747632925329993728
  • Last Price Increase: 2024-01-24
  • Automatic offers:
    • DylanDylann | Contributor | 28128915
    • dukenv0307 | Contributor | 28135067

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 @lschurr (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  3. neonbhai commented on Jan 16, 2024

    @neonbhai
    Contributor

    Proposal

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

    Remove NewRequestAmountPage.js and copy any changes since Nov 27 into IOURequestStepAmount.js

    What is the root cause of that problem?

    Clean up of NewRequestAmountPage

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

    We will be deleting the component here:

    function NewRequestAmountPage({route, iou, report, selectedTab}) {
    const styles = useThemeStyles();
    const {translate} = useLocalize();
    const prevMoneyRequestID = useRef(iou.id);

    This file will be removed. Looking at history (link), we had three changes. We will incorporate these into the PR (making sure no regressions)

    We will remove the screen from ModalStackNavigators.tsx here:

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

  4. njmulsqb commented on Jan 17, 2024

    @njmulsqb

    I would love to take this!

  5. dukenv0307 commented on Jan 17, 2024

    @dukenv0307
    Contributor

    Proposal

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

    Remove NewRequestAmountPage.js and copy any changes since Nov 27 into IOURequestStepAmount.js

    What is the root cause of that problem?

    This is a refactor

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

    Look at the history of the Old Component
    If there are any changes since Nov 27, 2023 which have not been added to the New Component, copy those changes

    1. The history change here: https://github.com/Expensify/App/blob/main/src/pages/iou/steps/NewRequestAmountPage.js

    We have had three changes since Nov 27, 2023 but it already had in IOURequestStepAmount. So no need to change here

    Replace all uses of the Old Component with the New Component
    Remove all traces of Old Component

    1. NewRequestAmountPage is only used in MoneyRequestSelectorPage and this page is also removed so we don't any updates here.

    We only need to remove NewRequestAmountPage in ModalStackNavigators, remove .MONEY_REQUEST.AMOUNT from SCREENS, and remove MONEY_REQUEST_AMOUNT route

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

    Be sure to update all routes and navigation to use the new :action param (instead of being hard-coded with "create")

    1. Update the getRoute function with an extra param action and return it instead of always returning create
    getRoute: (action: ValueOf<typeof CONST.IOU.ACTION>, iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo: string) =>
                getUrlWithBackToParam(`${action}/${iouType}/taxRate/${transactionID}/${reportID}`, backTo),
    

    getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string, backTo = '') =>

    We also need to update MONEY_REQUEST_CREATE_TAB_MANUAL route by adding a new action param instead of a constant created

    App/src/ROUTES.ts

    Lines 397 to 398 in 1b1eeb8

    route: 'create/:iouType/start/:transactionID/:reportID/manual',
    getRoute: (iouType: ValueOf<typeof CONST.IOU.TYPE>, transactionID: string, reportID: string) => `create/${iouType}/start/${transactionID}/${reportID}/manual` as const,

    Update any logic like isEditing to use the new action param from the route

    1. Re-use IOURequestStepAmount for edit case and remove EditRequestAmountPage.

    We will handle edit when action param is edit and we can re-use the logic of the saveAmountAndCurrency function in EditRequestPage to update amount for edit case. And when we click on amount in transaction report detail we will navigate to IOURequestStepAmount with action param as edit.

    1. Re-use IOURequestStepAmount for the edit split bill case. We can check this case by checking action and iouType param. We can re-use setDraftSplitTransaction function in EditSplitBillPage to update in IOURequestStepAmount as well

    2. Edit the route of MONEY_REQUEST_CREATE_TAB_MANUAL

    What alternative solutions did you explore? (Optional)

    NA

  6. dukenv0307 commented on Jan 17, 2024

    @dukenv0307
    Contributor

    @tgolen I have a question, after refactor in edit request amount page we will use MoneyRequestAmountForm or use IOURequestStepAmount with action is edit

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

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

    @melvin-bot

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

  11. 58 remaining items

  12. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Apr 8, 2024
  13. changed the title [-][$250] Remove NewRequestAmountPage.js and copy any changes since Nov 27 into IOURequestStepAmount.js[/-] [+][HOLD for payment 2024-04-15] [$250] Remove NewRequestAmountPage.js and copy any changes since Nov 27 into IOURequestStepAmount.js[/+] on Apr 8, 2024
  14. melvin-bot commented on Apr 8, 2024

    @melvin-bot

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

  15. melvin-bot commented on Apr 8, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.60-13 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-15. 🎊

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

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

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

    @lschurr
    Contributor

    @dukenv0307 @DylanDylann - Do we need a regression test here?

  18. DylanDylann commented on Apr 15, 2024

    @DylanDylann
    Contributor

    @lschurr This is a refactoring task, we don't need regression here.

  19. lschurr commented on Apr 15, 2024

    @lschurr
    Contributor

    Payment summary:

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.DailyKSv2ExternalAdded 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