-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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-06-13] [LOW] [Performance] Add no-spread-in-reduce to avoid recreating array in reduce method #42414
Comments
Triggered auto assignment to @garrettmknight ( |
Job added to Upwork: https://www.upwork.com/jobs/~011102640f041d624c |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann ( |
Hi @mountiny 👋 |
📣 @DylanDylann 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app! |
Just to double check, is task to create a ESLint rule to catch spread in reducers? |
📣 @lirbank! 📣
|
@lirbank Hello! The task will be handled by @kacper-mikolajczak (no However, the scope is to add the lint rule and fix all the places where its currently broken |
@garrettmknight, @mountiny, @kacper-mikolajczak, @DylanDylann Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Not overdue, we are waiting for PR to be ready for review |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.79-11 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-06-13. 🎊 For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
@DylanDylann you've been paid out - no regression test for this one. |
Problem
When you use the spread operator in an array reduce, it often leads to a partial object being copied over and over again in a loop.
Especially with large objects, this is very inefficient because ...acc will unnecessarily copy the full object on each iteration, rather than just adding the single key we want to add.
Solution
Prohibit this pattern with a new ESLint rule - no-spread-in-reduce. The above example would result in a lint error, and you might fix it with something more simple and efficient, like this:
@kacper-mikolajczak
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @garrettmknightThe text was updated successfully, but these errors were encountered: