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-10-27] [$250] Migrate index.js to function component #16145

Closed
1 task
marcaaron opened this issue Mar 20, 2023 · 41 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/~01eb40815378adee79
  • Upwork Job ID: 1710087370262638592
  • Last Price Increase: 2023-10-06
Issue OwnerCurrent Issue Owner: @johncschuster
@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
@Expensify Expensify unlocked this conversation Mar 21, 2023
@marcaaron marcaaron changed the title [HOLD] Migrate index.js to function component [HOLD][$250] Migrate index.js to function component Apr 13, 2023
@muxriddinmuqimov77
Copy link

I'd like to work on this issue

@s-alves10
Copy link
Contributor

I'd love to work on this.

@vdem0115
Copy link

vdem0115 commented Jul 7, 2023

I'd like to work on this issue

@Expensify Expensify locked and limited conversation to collaborators Jul 8, 2023
@marcaaron marcaaron changed the title [HOLD][$250] Migrate index.js to function component [$250] Migrate index.js to function component Oct 6, 2023
@marcaaron marcaaron self-assigned this Oct 6, 2023
@marcaaron marcaaron added the External Added to denote the issue can be worked on by a contributor label Oct 6, 2023
@melvin-bot melvin-bot bot unlocked this conversation Oct 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

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

@melvin-bot melvin-bot bot added the Daily KSv2 label Oct 6, 2023
@ZhenjaHorbach
Copy link
Contributor

I haven't refactored components for a long time))))

@ashuvssut
Copy link
Contributor

ashuvssut commented Oct 6, 2023

PROPOSAL

I will refactor this component as following:

  1. Refactoring into separate components
    Determine which JSX logics can be separated out of EmojiPickerMenu component "into separate components"
    For Example: Just like how EmojiPickerMenuItem class component is refactored out from EmojiPickerMenu class component. Here, All logics strictly related to EmojiPickerMenuItem got refactored out into that EmojiPickerMenuItem component too

  2. Refactoring into Custom Hooks
    Determine which non JSX logics could be refactored out of EmojiPickerMenu "into separate customs hooks". (separating logics into custom hooks is only done when you have logics which work with React hooks themselves. )

  3. All component lifecycle methods will get rewritten using useEffect hook

  4. Use useRef for:

    • for component refs like searchInput & emojiList
    • for creating non-reactive variables like firstNonHeaderIndex. (For creating a mutable variable which won't trigger a re-render when we mutate it. Its value will be preserved across renders, i,e It won't be reinitalized if component gets re-rendered )

EDIT:-

  1. Use TypeScript for props types and function parameter type(Also this renames file extension:-*.js into *.tsx)

    • This may remove the need of using proptypes library
    • This may remove the need of using JSDoc comment for param type
  2. Barrel import the components just like MapView.tsx

  3. Remove redundant code.

  1. Fix bad practices
    • in this line we are reading this.headerEmojis (which is a ref) during a render. We must not read or write refs during render (This applies to Functional Component. I am not 100% sure that this affects class components)
    • Docs reference
      image

I will work on the POC of what I have explained above.

  • I will just do the conversion to Class component for the Draft PR.
  • I will be updating this comment as I refactor the file. (to add more refactoring ideas)

UPDATE

I have completed the conversion from class to functional component for the Draft PR.

Working PoC video

Peek.2023-10-07.21-15.mp4

Pending work
Only the TypeScript type annotations are remaining + all the refactoring into separate components / custom hooks are remaining. I will work on that once this issue is assigned to me

@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

📣 @ashuvssut! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@ashuvssut

This comment was marked as off-topic.

@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@aim-salam
Copy link

How do I know the issue is still open?

@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

📣 @aim-salam! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@neonbhai
Copy link
Contributor

neonbhai commented Oct 6, 2023

I would love to work on this!

@kamicodaxe
Copy link

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: [email protected]

@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@vadymbokatov
Copy link
Contributor

Proposal

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

this component is class based

What is the root cause of that problem?

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

we should migrate to functional components.

What alternative solutions did you explore? (Optional)

@ashuvssut
Copy link
Contributor

The PR is ready

@melvin-bot
Copy link

melvin-bot bot commented Oct 18, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @ashuvssut got assigned: 2023-10-10 18:32:02 Z
  • when the PR got merged: 2023-10-18 01:26:36 UTC
  • days elapsed: 5

On to the next one 🚀

@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

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

melvin-bot bot commented Oct 20, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 20, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.87-12 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-10-27. 🎊

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

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

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

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Oct 27, 2023
@ashuvssut
Copy link
Contributor

Hi @Santhosh-Sellavel @marcaaron

I havent received my payment for this contribution. Who should I reach out to?

Also, I saw in upwork that I haven't been hired yet for the job

I have a fully verified upwork account

@Santhosh-Sellavel
Copy link
Collaborator

@marcaaron please assign a BZ here, thanks!

@marcaaron marcaaron added the Bug Something is broken. Auto assigns a BugZero manager. label Oct 31, 2023
Copy link

melvin-bot bot commented Oct 31, 2023

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

This comment was marked as resolved.

@marcaaron marcaaron removed the Bug Something is broken. Auto assigns a BugZero manager. label Oct 31, 2023
@melvin-bot melvin-bot bot added the Overdue label Nov 3, 2023
@ashuvssut
Copy link
Contributor

@johncschuster @marcaaron any update on the payment issue?

Copy link

melvin-bot bot commented Nov 6, 2023

@johncschuster, @marcaaron, @ashuvssut, @Santhosh-Sellavel Eep! 4 days overdue now. Issues have feelings too...

@ashuvssut
Copy link
Contributor

@johncschuster seems like the Job has expired

image

@Santhosh-Sellavel
Copy link
Collaborator

@johncschuster Bump for the above, also please leave a payment summary message!

@johncschuster
Copy link
Contributor

Thanks for the bump on the expired job! I'll get a manual one spun up.

@johncschuster
Copy link
Contributor

@ashuvssut can you please comment on the issue above so I can assign it to you? That should create the Upwork job.

@johncschuster
Copy link
Contributor

Payment Summary:

@ashuvssut requires payment (will be paid via Upwork here) - $250
@Santhosh-Sellavel does not require payment (Eligible for Manual Requests) - $250

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