You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Tracking] Refactor functions with many parameters to use parameter objects #50368
Problem: Many functions in the App repo have a very large amount of parameters, making it very hard to work with them. If you need some data that isn’t available with existing parameters you need to add a new one. The safe way to do that is to add it as an optional param at the end of the list. In order to pass it to the function from an existing call you have to fill in all params between the last one used and this new last param. It’s time consuming to fill out the defaults, and any required params require careful considering. Re-ordering parameters is risky and requires updating all existing calls. Also, we often have cases where we have a transaction object in the component, then call a function passing various fields of the transaction split out into n parameters. Wouldn’t it be so much easier to pass the original object? Sometimes we also pass the ID of the object in Onyx only to retrieve it from an Onyx connection later.
Solution: Gradually refactor functions to take in parameter objects, where it’s easier to re-order. Strive to minimize the number of fields. Group parameters into sensible sub-objects. Avoid duplicate prefixes such as parameters.chat.chatReport, use parameters.chat.report instead. Thrive 😄
@neil-marcellini we could start with IOU.getTrackExpenseInformation, IOU.shareTrackedExpense, IOU.categorizeTrackedExpense after these three IOU.trackExpense.
These functions mostly share common data and could be refactored with ease for a start.
I would like to work on this and following if you want external contributor to work here.
changed the title [-][Tracking] Refactor functions with many parameters to use parameter objects[/-][+][$250] [Tracking] Refactor functions with many parameters to use parameter objects[/+]on Oct 16, 2024
Activity
ChavdaSachin commentedon Oct 8, 2024
@neil-marcellini we could start with IOU.getTrackExpenseInformation, IOU.shareTrackedExpense, IOU.categorizeTrackedExpense after these three IOU.trackExpense.
These functions mostly share common data and could be refactored with ease for a start.
I would like to work on this and following if you want external contributor to work here.
melvin-bot commentedon Oct 16, 2024
Job added to Upwork: https://www.upwork.com/jobs/~021846632713060454080
[-][Tracking] Refactor functions with many parameters to use parameter objects[/-][+][$250] [Tracking] Refactor functions with many parameters to use parameter objects[/+]melvin-bot commentedon Oct 16, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @dukenv0307 (
External)neil-marcellini commentedon Oct 16, 2024
Sure @ChavdaSachin, please go ahead and start with only IOU.categorizeTrackedExpense
125 remaining items
neil-marcellini commentedon Mar 14, 2025
We're ticking away at various sub issues
neil-marcellini commentedon Mar 19, 2025
Same update
neil-marcellini commentedon Mar 31, 2025
Today I'm reviewing the PR for [App] fix: Refactor completeOnboarding to use a parameter object.
neil-marcellini commentedon Apr 16, 2025
I think this is basically all done now. Thanks to everyone who helped out!