Skip to content

[HOLD for payment 2024-03-26] [$250] Remove MoneyRequestSelectorPage.js and copy any changes since Nov 27 into IOURequestStartPage.js #34613

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: MoneyRequestSelectorPage
New Component IOURequestStartPage

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/~011477b63464907ecf
  • Upwork Job ID: 1747632909135507456
  • Last Price Increase: 2024-01-17
  • Automatic offers:
    • hoangzinh | Reviewer | 28117811
    • Krishna2323 | Contributor | 28117812
Issue OwnerCurrent Issue Owner: @garrettmknight

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

  3. Krishna2323 commented on Jan 16, 2024

    @Krishna2323
    Contributor

    Proposal

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

    Remove MoneyRequestSelectorPage.js and copy any changes since Nov 27 into IOURequestStartPage.js

    What is the root cause of that problem?

    Component update

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

    I checked all the commits after 27th Nov and the new component is updated according to the old component, we just need to remove the file and route created for it. I checked the commits thoroughly but will check again in the PR. There are total 10 commits which includes importing updated components, updating const variables and adding a policy prop. All of them have been updated inside new component also.

    Component to remove:
    https://github.com/Expensify/App/blob/main/src/pages/iou/MoneyRequestSelectorPage.js

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

    We also need to remove all traces from src/libs/Navigation/types.ts & src/libs/Navigation/linkingConfig.ts:

    [SCREENS.MONEY_REQUEST.ROOT]: {

    [SCREENS.MONEY_REQUEST.ROOT]: undefined;

    We will update to :action param here:

    route: 'create/:iouType/start/:transactionID/:reportID',

    We are using ROUTES.MONEY_REQUEST_CREATE.getRoute from several places so we need to add action accordingly:

    onSelected: () => Navigation.navigate(ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.SPLIT, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, report.reportID)),

    onSelected: () => Navigation.navigate(ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.REQUEST, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, report.reportID)),

    ROUTES.MONEY_REQUEST_CREATE.getRoute(CONST.IOU.TYPE.REQUEST, CONST.IOU.OPTIMISTIC_TRANSACTION_ID, ReportUtils.generateReportID()),

    There is a comment inside NewRequestAmountPage which mentions MoneyRequestSelectorPage, we also need to update that.

    // ScreenWrapper is only needed in edit mode because we have a dedicated route for the edit amount page (MoneyRequestEditAmountPage).
    // The rest of the cases this component is rendered through <MoneyRequestSelectorPage /> which has it's own ScreenWrapper

    There are 4 components which will get the action param with this update & uses IOU actions, most of them will be only used for create so it will only update TRANSACTION_DRAFT inside Onyx thats why we don't need to use isDraft parameter for actions. We only support editing inside IOURequestStepScan and there is a action setMoneyRequestReceipt which needs isDraft parameter for updating the TRANSACTION_DRAFT or TRANSACTION accordingly but we already handle that correctly.

    IOU.setMoneyRequestReceipt(transactionID, source, file.name, action !== CONST.IOU.ACTION.EDIT);
    if (action === CONST.IOU.ACTION.EDIT) {
    updateScanAndNavigate(file, source);
    return;
    }

    IOU.setMoneyRequestReceipt(transactionID, source, file.name, action !== CONST.IOU.ACTION.EDIT);
    if (action === CONST.IOU.ACTION.EDIT) {
    updateScanAndNavigate(file, source);
    return;
    }

    Result

  4. njmulsqb commented on Jan 17, 2024

    @njmulsqb

    I would love to take this!

  5. DylanDylann commented on Jan 17, 2024

    @DylanDylann
    Contributor

    Proposal

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

    Remove MoneyRequestSelectorPage.js and copy any changes since Nov 27 into IOURequestStartPage.js

    What is the root cause of that problem?

    Remove deprecated component

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

    1. Remove MoneyRequestSelectorPage component and all traces
      [SCREENS.MONEY_REQUEST.ROOT]: () => require('../../../pages/iou/MoneyRequestSelectorPage').default as React.ComponentType,

    [SCREENS.MONEY_REQUEST.ROOT]: {
    path: ROUTES.MONEY_REQUEST.route,
    exact: true,
    screens: {
    [SCREENS.MONEY_REQUEST.MANUAL_TAB]: {
    path: ROUTES.MONEY_REQUEST_MANUAL_TAB,
    exact: true,
    },
    [SCREENS.MONEY_REQUEST.SCAN_TAB]: {
    path: ROUTES.MONEY_REQUEST_SCAN_TAB,
    exact: true,
    },
    [SCREENS.MONEY_REQUEST.DISTANCE_TAB]: {
    path: ROUTES.MONEY_REQUEST_DISTANCE_TAB.route,
    exact: true,
    },
    },
    },
    [SCREENS.MONEY_REQUEST.AMOUNT]: ROUTES.MONEY_REQUEST_AMOUNT.route,

    App/src/ROUTES.ts

    Lines 249 to 252 in a2f5bd5

    MONEY_REQUEST: {
    route: ':iouType/new/:reportID?',
    getRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}` as const,
    },

    and all sub route ROUTES.MONEY_REQUEST_MANUAL_TAB, ROUTES.MONEY_REQUEST_SCAN_TAB, ROUTES.MONEY_REQUEST_DISTANCE_TAB

    We also need to update ROUTES.MONEY_REQUEST.getRoute to ROUTES.MONEY_REQUEST_CREATE.getRoute in all places

    1. Copy changes since 27 Nov to new components based on list commit here: https://github.com/Expensify/App/commits/main/src/pages/iou/MoneyRequestSelectorPage.js

    What alternative solutions did you explore? (Optional)

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

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

    @melvin-bot

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

  10. MahmudjonToraqulov commented on Jan 17, 2024

    @MahmudjonToraqulov
    Contributor

    I would love to take this!

  11. 68 remaining items

  12. changed the title [-][$250] Remove MoneyRequestSelectorPage.js and copy any changes since Nov 27 into IOURequestStartPage.js[/-] [+][HOLD for payment 2024-03-26] [$250] Remove MoneyRequestSelectorPage.js and copy any changes since Nov 27 into IOURequestStartPage.js[/+] on Mar 19, 2024
  13. melvin-bot commented on Mar 19, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.54-4 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-03-26. 🎊

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

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

    @Krishna2323
    Contributor

    @garrettmknight, bump for payments.

  16. garrettmknight commented on Mar 28, 2024

    @garrettmknight
    Contributor

    @Krishna2323 just paid you.

    @hoangzinh sent a new offer to you since the old one expired. (link)

  17. hoangzinh commented on Mar 29, 2024

    @hoangzinh
    Contributor

    Accepted. Thanks @garrettmknight

  18. garrettmknight commented on Apr 2, 2024

    @garrettmknight
    Contributor

    All paid up, closing.

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