Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #29107
tgolen opened this issue Jan 16, 2024 · 53 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@tgolen
Copy link
Contributor

tgolen commented Jan 16, 2024

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
@tgolen tgolen added Engineering Daily KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors Bug Something is broken. Auto assigns a BugZero manager. labels Jan 16, 2024
Copy link

melvin-bot bot commented Jan 16, 2024

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

@Krishna2323
Copy link
Contributor

Krishna2323 commented Jan 16, 2024

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

@njmulsqb
Copy link

I would love to take this!

@DylanDylann
Copy link
Contributor

DylanDylann commented Jan 17, 2024

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)

@tgolen tgolen added the External Added to denote the issue can be worked on by a contributor label Jan 17, 2024
@melvin-bot melvin-bot bot 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 Jan 17, 2024
Copy link

melvin-bot bot commented Jan 17, 2024

Job added to Upwork: https://www.upwork.com/jobs/~011477b63464907ecf

Copy link

melvin-bot bot commented Jan 17, 2024

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

@MahmudjonToraqulov
Copy link
Contributor

I would love to take this!

@ghost
Copy link

ghost commented Jan 17, 2024

I want to work on it

@ishpaul777
Copy link
Contributor

I'd love to work on the issue

@mountiny mountiny changed the title [$500] Remove MoneyRequestSelectorPage.js and copy any changes since Nov 27 into IOURequestStartPage.js [$250] Remove MoneyRequestSelectorPage.js and copy any changes since Nov 27 into IOURequestStartPage.js Jan 17, 2024
Copy link

melvin-bot bot commented Jan 17, 2024

Upwork job price has been updated to $250

@melvin-bot melvin-bot bot added the Overdue label Jan 19, 2024
@michaelhaxhiu
Copy link
Contributor

@hoangzinh how do you feel about the proposal above?

Others on the GH issue need to suggest a proposal as well to be considered here, btw.

@melvin-bot melvin-bot bot removed the Overdue label Jan 19, 2024
@Krishna2323
Copy link
Contributor

Proposal Updated

Replaced the permalink inside ModalStackNavigators.tsx, by mistake I mentioned line 94 instead of 93.

@melvin-bot melvin-bot bot added the Overdue label Jan 22, 2024
@hoangzinh
Copy link
Contributor

Sorry for late update, I will post review today

@hoangzinh
Copy link
Contributor

@Krishna2323 , @DylanDylann thanks for your proposal. @Krishna2323's proposal #34613 (comment) looks good to me because he's first and his proposal pointed out:

  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

Link to proposal #34613 (comment)

🎀👀🎀 C+ reviewed

@hoangzinh

This comment was marked as off-topic.

@DylanDylann
Copy link
Contributor

@hoangzinh could you help to check edit history? @Krishna2323 updated proposal after i posted proposal

@garrettmknight
Copy link
Contributor

Back - PR is still in progress.

Copy link

melvin-bot bot commented Feb 29, 2024

@garrettmknight, @hoangzinh, @Krishna2323 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@hoangzinh
Copy link
Contributor

we're in a final discussion here #35455 (comment)

@garrettmknight
Copy link
Contributor

Final final discussion 😆

Copy link

melvin-bot bot commented Mar 12, 2024

Triggered auto assignment to @neil-marcellini, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link

melvin-bot bot commented Mar 13, 2024

@garrettmknight, @hoangzinh, @neil-marcellini, @Krishna2323 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@hoangzinh
Copy link
Contributor

awaiting @neil-marcellini to do the final review round

@garrettmknight garrettmknight removed the Reviewing Has a PR in review label Mar 19, 2024
@melvin-bot melvin-bot bot added the Overdue label Mar 19, 2024
@garrettmknight
Copy link
Contributor

This has been reviewed, merged and deployed to staging.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Overdue Daily KSv2 labels Mar 19, 2024
@melvin-bot melvin-bot bot 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 Mar 19, 2024
Copy link

melvin-bot bot commented Mar 19, 2024

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:

Copy link

melvin-bot bot commented Mar 19, 2024

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:

@Krishna2323
Copy link
Contributor

@garrettmknight, bump for payments.

@melvin-bot melvin-bot bot added the Overdue label Mar 28, 2024
@garrettmknight
Copy link
Contributor

garrettmknight commented Mar 28, 2024

@Krishna2323 just paid you.

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

@melvin-bot melvin-bot bot removed the Overdue label Mar 28, 2024
@garrettmknight garrettmknight added Daily KSv2 and removed Weekly KSv2 labels Mar 28, 2024
@hoangzinh
Copy link
Contributor

Accepted. Thanks @garrettmknight

@melvin-bot melvin-bot bot added the Overdue label Apr 1, 2024
@garrettmknight
Copy link
Contributor

All paid up, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests