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 2025-01-18] [$250] Remove withCurrentReportID HOC #50510

Closed
luacmartins opened this issue Oct 9, 2024 · 21 comments
Closed
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@luacmartins
Copy link
Contributor

luacmartins commented Oct 9, 2024

Coming from here, we should remove the withCurrentReportID HOC in favor of useCurrentReportID hook

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021869425871317443271
  • Upwork Job ID: 1869425871317443271
  • Last Price Increase: 2024-12-25
  • Automatic offers:
    • dominictb | Reviewer | 105506145
    • etCoderDysto | Contributor | 105506146
Issue OwnerCurrent Issue Owner: @dominictb
@luacmartins
Copy link
Contributor Author

Not a priority

@melvin-bot melvin-bot bot removed the Overdue label Nov 13, 2024
@melvin-bot melvin-bot bot added the Overdue label Dec 16, 2024
@luacmartins
Copy link
Contributor Author

Same

@melvin-bot melvin-bot bot removed the Overdue label Dec 18, 2024
@luacmartins luacmartins added Weekly KSv2 External Added to denote the issue can be worked on by a contributor Monthly KSv2 and removed Monthly KSv2 Weekly KSv2 labels Dec 18, 2024
@melvin-bot melvin-bot bot changed the title Remove withCurrentReportID HOC [$250] Remove withCurrentReportID HOC Dec 18, 2024
Copy link

melvin-bot bot commented Dec 18, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 18, 2024
@luacmartins luacmartins added Daily KSv2 and removed Monthly KSv2 labels Dec 18, 2024
Copy link

melvin-bot bot commented Dec 18, 2024

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

@etCoderDysto
Copy link
Contributor

etCoderDysto commented Dec 18, 2024

Edited by proposal-police: This proposal was edited at 2024-12-18 17:02:18 UTC.

Proposal

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

Remove withCurrentReportID HOC

What is the root cause of that problem?

Refactor

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

Replace every usage of withCurrentReportID hoc with useCurrentReportID hook

export default function withCurrentReportID<TProps extends CurrentReportIDContextValue, TRef>(
WrappedComponent: ComponentType<TProps & RefAttributes<TRef>>,
): (props: Omit<TProps, keyof CurrentReportIDContextValue> & React.RefAttributes<TRef>) => React.ReactElement | null {
function WithCurrentReportID(props: Omit<TProps, keyof CurrentReportIDContextValue>, ref: ForwardedRef<TRef>) {
return (
<CurrentReportIDContext.Consumer>

Places to replce the hoc
Report screen

export default withCurrentReportID(memo(ReportScreen, (prevProps, nextProps) => prevProps.currentReportID === nextProps.currentReportID && lodashIsEqual(prevProps.route, nextProps.route)));

And we should check for all used palces

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

What alternative solutions did you explore? (Optional)

Copy link
Contributor

cole Your proposal will be dismissed because you did not follow the proposal template.

@mkzie2
Copy link
Contributor

mkzie2 commented Dec 18, 2024

Proposal

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

Remove withCurrentReportID HOC

What is the root cause of that problem?

Improvement

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

  1. This HOC is only used in ReportScreen, we can replace this with useCurrentReportID hook and update the ReportScreenProps
const {currentReportID} = useCurrentReportID();

export default function withCurrentReportID<TProps extends CurrentReportIDContextValue, TRef>(
WrappedComponent: ComponentType<TProps & RefAttributes<TRef>>,
): (props: Omit<TProps, keyof CurrentReportIDContextValue> & React.RefAttributes<TRef>) => React.ReactElement | null {
function WithCurrentReportID(props: Omit<TProps, keyof CurrentReportIDContextValue>, ref: ForwardedRef<TRef>) {
return (
<CurrentReportIDContext.Consumer>

export default withCurrentReportID(memo(ReportScreen, (prevProps, nextProps) => prevProps.currentReportID === nextProps.currentReportID && lodashIsEqual(prevProps.route, nextProps.route)));

  1. After that we can remove withCurrentReportID file and move all logic of CurrentReportIDContextProvider from withCurrentReportID file to useCurrentReportID file to centralize logic.

export default function withCurrentReportID<TProps extends CurrentReportIDContextValue, TRef>(
WrappedComponent: ComponentType<TProps & RefAttributes<TRef>>,
): (props: Omit<TProps, keyof CurrentReportIDContextValue> & React.RefAttributes<TRef>) => React.ReactElement | null {
function WithCurrentReportID(props: Omit<TProps, keyof CurrentReportIDContextValue>, ref: ForwardedRef<TRef>) {
return (
<CurrentReportIDContext.Consumer>

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

What alternative solutions did you explore? (Optional)

NA

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@dominictb
Copy link
Contributor

on it now

@dominictb
Copy link
Contributor

@etCoderDysto's proposal look good to me.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Dec 23, 2024

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

@dominictb
Copy link
Contributor

Moving the logic of CurrentReportIDContextProvider to useCurrentReportID can be a good idea, but it doesn't really matter. What do you think @chiragsalian?

Copy link

melvin-bot bot commented Dec 25, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Dec 25, 2024
@dominictb
Copy link
Contributor

@chiragsalian @luacmartins can you please take a look at this decision when you have a chance?

@melvin-bot melvin-bot bot removed the Overdue label Dec 26, 2024
@melvin-bot melvin-bot bot added Overdue and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Dec 30, 2024
Copy link

melvin-bot bot commented Dec 30, 2024

📣 @dominictb 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot melvin-bot bot removed the Overdue label Dec 30, 2024
Copy link

melvin-bot bot commented Dec 30, 2024

📣 @etCoderDysto 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@luacmartins
Copy link
Contributor Author

Sorry, was ooo. Assinged @etCoderDysto to the issue

@etCoderDysto
Copy link
Contributor

Thanks! Pr will be ready for review by tomorrow.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jan 1, 2025
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 11, 2025
@melvin-bot melvin-bot bot changed the title [$250] Remove withCurrentReportID HOC [HOLD for payment 2025-01-18] [$250] Remove withCurrentReportID HOC Jan 11, 2025
Copy link

melvin-bot bot commented Jan 11, 2025

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 11, 2025
Copy link

melvin-bot bot commented Jan 11, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.83-5 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 2025-01-18. 🎊

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 17, 2025
Copy link

melvin-bot bot commented Jan 18, 2025

Issue is ready for payment but no BZ is assigned. @trjExpensify you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!

@trjExpensify
Copy link
Contributor

Perf optimisation to remove an unused HOC, no regression test needed.

Payment summary as follows:

Paid, 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 Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants