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 2023-06-19] [$250] Migrate ReportFooter.js to function component #16268

Closed
1 task
marcaaron opened this issue Mar 20, 2023 · 33 comments
Closed
1 task
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Improvement Item broken or needs improvement.

Comments

@marcaaron
Copy link
Contributor

marcaaron commented Mar 20, 2023

Class Component Migration

Filenames

Task

  • We currently have some class components in our codebase that we would like to refactor to a function component.
  • Here's a link with some general advice on how to refactor a class component to a function component: https://react.dev/reference/react/Component#alternatives
  • If you need additional guidance, please ask in #expensify-open-source
  • Test for any regressions and verify that there are no breaking changes
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01587290f1883b1269
  • Upwork Job ID: 1665689038067744768
  • Last Price Increase: 2023-06-05
@marcaaron marcaaron added Engineering Improvement Item broken or needs improvement. labels Mar 20, 2023
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Mar 20, 2023
@mountiny mountiny self-assigned this Mar 20, 2023
@Expensify Expensify unlocked this conversation Mar 21, 2023
@marcaaron marcaaron changed the title [HOLD] Migrate ReportFooter.js to function component [HOLD][$250] Migrate ReportFooter.js to function component Apr 13, 2023
@MelvinBot
Copy link

⚠️ Could not update price automatically because there is no linked Upwork Job ID. The BZ team member will need to update the price manually in Upwork.

@marcaaron
Copy link
Contributor Author

Heads up! The pricing for this issue has been adjusted based on the scope of the work and the fact that no complex bug investigations or proposal are required.

@mountiny
Copy link
Contributor

Lower priority right now but I will try to get to this soon

@marcaaron marcaaron added the Daily KSv2 label Jun 2, 2023
@marcaaron marcaaron changed the title [HOLD][$250] Migrate ReportFooter.js to function component [$250] Migrate ReportFooter.js to function component Jun 2, 2023
@marcaaron
Copy link
Contributor Author

Heads up, I'm taking this issue off HOLD and making it a Daily. If you are unable to work on it please remove your assignment and add the External + Help Wanted labels as per this update.

@dhairyasenjaliya
Copy link
Contributor

I can work on this if goes to external

@melvin-bot melvin-bot bot added the Overdue label Jun 5, 2023
@mountiny mountiny added Help Wanted Apply this label when an issue is open to proposals by contributors External Added to denote the issue can be worked on by a contributor labels Jun 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

Triggered auto assignment to @MitchExpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

Current assignee @mountiny is eligible for the External assigner, not assigning anyone new.

@mountiny
Copy link
Contributor

mountiny commented Jun 5, 2023

@dhairyasenjaliya are you working on anay other refactor now? following this guideline https://expensify.slack.com/archives/C01GTK53T8Q/p1685729601728839?thread_ts=1685727880.152119&cid=C01GTK53T8Q

@melvin-bot melvin-bot bot removed the Overdue label Jun 5, 2023
@kushu7
Copy link
Contributor

kushu7 commented Jun 5, 2023

I would like to take this refactoring

@dhairyasenjaliya
Copy link
Contributor

@mountiny currently not working on any refactoring task

@multijump
Copy link
Contributor

I would like to take this.

@mountiny
Copy link
Contributor

mountiny commented Jun 5, 2023

@dhairyasenjaliya since you were first on this issue after the announcement in Slack, I am going to assing you

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

📣 @dhairyasenjaliya You have been assigned to this job by @mountiny!
Please apply to this job in Upwork 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 📖

@mountiny
Copy link
Contributor

mountiny commented Jun 5, 2023

Thanks everyone, be on a look out for other migration issues, assigning @dhairyasenjaliya as they were the first one to raise hands after the announcement

@dhairyasenjaliya
Copy link
Contributor

alright PR coming up soon thnx @mountiny

@the-mold
Copy link
Contributor

the-mold commented Jun 5, 2023

Proposal

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

Refactor the component src/pages/home/report/ReportFooter.js to a function component

What is the root cause of that problem?

Class components are deprecated. We need to upgrade the component to the function component by following the guidelines: https://react.dev/reference/react/Component#alternatives.

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

  1. Substitute the getChatFooterStyles with the useMemo hook that has single dependency props.isOffline.

    getChatFooterStyles() {
    return {...styles.chatFooter, minHeight: !this.props.isOffline ? CONST.CHAT_FOOTER_MIN_HEIGHT : 0};
    }

  2. Both constants isArchivedRoom and isAllowedToComment should be calculated by a single useMemo hook with the single dependency props.report.

    const isArchivedRoom = ReportUtils.isArchivedRoom(this.props.report);
    const isAllowedToComment = ReportUtils.isAllowedToComment(this.props.report);

  3. hideComposer should be calculated with useMemo hook with the dependencies [props.errors, isAllowedToComment]

    const hideComposer = isArchivedRoom || !_.isEmpty(this.props.errors) || !isAllowedToComment;

  4. Remove this bindings and use the props argument that are passed to the function component.

What alternative solutions did you explore? (Optional)

NA

@mountiny
Copy link
Contributor

mountiny commented Jun 5, 2023

@petromoldovan thanks for the proposal, since these issues are quite straightforwards, we are going based on the first come firse serve basis and each developer only has one assigned at the time, see this update in slack for more info https://expensify.slack.com/archives/C01GTK53T8Q/p1685727880152119

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jun 5, 2023
@dhairyasenjaliya
Copy link
Contributor

@s77rt @mountiny PR ready for review

@Vishrut19
Copy link
Contributor

Is it open ?

@s77rt
Copy link
Contributor

s77rt commented Jun 5, 2023

@Vishrut19 This issue does not have Help Wanted label, so no. But there are many other open issues checkout issues with Help Wanted label.

@mountiny
Copy link
Contributor

mountiny commented Jun 7, 2023

Pr Merged 🎉

@dhairyasenjaliya
Copy link
Contributor

Awesome 👌

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jun 12, 2023
@melvin-bot melvin-bot bot changed the title [$250] Migrate ReportFooter.js to function component [HOLD for payment 2023-06-19] [$250] Migrate ReportFooter.js to function component Jun 12, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 12, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.26-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 2023-06-19. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@MitchExpensify
Copy link
Contributor

Payment reminder set in my cal 👍

@MitchExpensify
Copy link
Contributor

Invites sent for payment @s77rt @dhairyasenjaliya 👍

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 19, 2023
@MitchExpensify
Copy link
Contributor

Paid with bonuses!

@s77rt
Copy link
Contributor

s77rt commented Jun 21, 2023

I don't think bonus applies for migration. I have refunded the bonus.

@dhairyasenjaliya
Copy link
Contributor

Yeah agree will refund too within an hour

@dhairyasenjaliya
Copy link
Contributor

Refunded bonus :) @MitchExpensify

@MitchExpensify
Copy link
Contributor

Ah, thanks for the catch team! I appreciated the speed of assignment to merge all the same 😆

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 Engineering External Added to denote the issue can be worked on by a contributor Improvement Item broken or needs improvement.
Projects
None yet
Development

No branches or pull requests

10 participants