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
Refactor getReportName to prepare for formula computation #72613
Hey, happy to help with this feature! Here’s the PR list I’d create, feel free to correct me if I wrote something unclear or if you’d change anything, as I’m still getting familiar with the project.
1. Simplify getReportName and create computeReportName()
Simplify getReportName:
Create new function that will allow us to migrate existing getReportName step by step for the time of migration.
New logic: check if reportAttribute for a given report exists in the attributes store and if so return its reportName value. Otherwise return reportName accessed from report.
Change this component to use new implementation to spot any issues (its subtitle of room members page)
src/pages/RoomMembersPage.tsx
prop
Simple call with StringUtils.lineBreaksToSpaces
Create computeReportName() which contain old logic from getReportName()
Quick notes:
1.
perf and unit tests can be one PR, but I do honestly think that at least unit should be provided together with implementation of computeReportName or new getReportName
2.
Either create new function that will allow us to migrate existing getReportName step by step or add argument to existing one that will allow to freely change between old and new logic for the time of migration.
I personally think that create new function definition will be more maintanable and writing tests would be easier. In the end we need only to remove old method and potentially rename the new.
3.
First PR should also introduce computeReportName which contains logic extracted from old getReportName. So in the end of first PR we have working logic that can be used both in derived values and in UI refactors
4.
First PR can have one correct implementation in UI to check if its working perfectly correct - QA Team will be able to spot problems from day 0. @neil-marcellini what do you think?
5.
This is to @neil-marcellini. What do you think about this PR granulation?
one more thing to check. getReportName is dependant on variables that are not present in reportAttributes's dependencies. Eg. parentReportActionParam, invoiceReceiverPolicy. How we will handle that?
@sosek108 I've updated my PR split to include your comments. Whenever you have time, please re-check it. Now I’ll look into the issue you mentioned in the comment below (about the missing dependencies).
@sosek108 I think for those two arguments, we could create an additional function named getReportNameWithArgs.
From what I’ve checked in the code, we can extract the logic related to those two arguments and either return the result directly or prioritise those arguments if both are needed.
For cases where we need to perform two checks, I’d suggest something like this:
For the rest of the cases, I’d just check if one of the functions returns something and fall back to getReportName().
I’m not sure if this approach works for you, maybe you’ll have a better idea.
I’d prefer to avoid adding this logic to the compute function since it would make it too bloated, but that might also be a possible solution. We can discuss this tomorrow when you're back, just to make sure I didn't miss anything.
Another idea would be to change the getReportName() signature to getReportName(report, attributes, params?) and pass invoiceReceiverPolicy or parentReportActionParam in params.
To keep getReportName cleaner, since parentReportActionParam is returned in over 30 if statements, we could extract this logic before returning the new logic from design docs (reportAttributes[reportId].reportName || report.reportName).
It might also be a good idea to clean this up a bit, as this is one of the main reasons why getReportName() is currently so long.
We can also separate invoiceReceiverPolicy in the same way, although it’s only used in two if statements within the return. The only concern I have with this extraction is how much the order of the if statements in the current getReportName() matters.
Activity
sosek108 commentedon Oct 16, 2025
@neil-marcellini To speed up work on this @kstroz will help me with the refactor. Please assign him to this task
sosek108 commentedon Oct 16, 2025
@neil-marcellini Can you please give access to @kstroz to the Design Doc?
sosek108 commentedon Oct 16, 2025
Sorry, no major update here. I had been distracted by other tasks on Expensify. @kstroz took the time to review the project.
Tomorrow we'll update Design Doc with a solid plan how refactor will be implemented.
@kstroz remember to leave daily update on the progress
kstroz commentedon Oct 17, 2025
Hey, happy to help with this feature! Here’s the PR list I’d create, feel free to correct me if I wrote something unclear or if you’d change anything, as I’m still getting familiar with the project.
1. Simplify getReportName and create computeReportName()
Simplify getReportName:
Change this component to use new implementation to spot any issues (its subtitle of room members page)
Create computeReportName() which contain old logic from getReportName()
Total usage: 2
2. Core Utilities - ReportUtils Internal
Note: I’m not 100% sure if we want to include all of these in a single PR.
Total usage: 6
3. Sidebar & List Utilities
Why together: These are tightly coupled utilities used for list rendering and sidebar display. Similar usage patterns.
Total usage: 8
4. Action & Search & Query Utils
Why together: Relatively simple usages.
Total usage: 3
5. Report Action Utilities
Why together: All related to report actions and their messages. Note the function reference case needs special handling.
Total usage: 4
6. Money Request Components
Why together: All related to money request confirmation flow.
Total usage: 2
7. Report Header Components
Why together: Both are header/title display components with complex parameter usage.
Total usage: 2
8. Report Details Pages
Why together: All are report detail/member management pages with similar usage patterns.
Total usage: 2
9. IOU/Expense Pages
Why together: Both related to expense/transaction editing flows.
Total usage: 2
10. Modal & Media Components
Why together: Both modal/popover UI components.
Total usage: 3
11. Workspace & Misc Utilities
Why together: Miscellaneous utilities not fitting other categories, relatively simple usages.
Total usage: 3
12. Remaining Pages & Components
Why together: Remaining pages with simple usages.
Total usage: 6
13. Add tests
sosek108 commentedon Oct 17, 2025
Thanks @kstroz! Overall great summary
Quick notes:
1.
perf and unit tests can be one PR, but I do honestly think that at least unit should be provided together with implementation of
computeReportNameor newgetReportName2.
I personally think that create new function definition will be more maintanable and writing tests would be easier. In the end we need only to remove old method and potentially rename the new.
3.
First PR should also introduce
computeReportNamewhich contains logic extracted from oldgetReportName. So in the end of first PR we have working logic that can be used both in derived values and in UI refactors4.
First PR can have one correct implementation in UI to check if its working perfectly correct - QA Team will be able to spot problems from day 0. @neil-marcellini what do you think?
5.
This is to @neil-marcellini. What do you think about this PR granulation?
sosek108 commentedon Oct 17, 2025
@kstroz
one more thing to check.
getReportNameis dependant on variables that are not present inreportAttributes's dependencies. Eg. parentReportActionParam, invoiceReceiverPolicy. How we will handle that?kstroz commentedon Oct 20, 2025
@sosek108 I've updated my PR split to include your comments. Whenever you have time, please re-check it. Now I’ll look into the issue you mentioned in the comment below (about the missing dependencies).
kstroz commentedon Oct 20, 2025
@sosek108 I think for those two arguments, we could create an additional function named getReportNameWithArgs.
From what I’ve checked in the code, we can extract the logic related to those two arguments and either return the result directly or prioritise those arguments if both are needed.
For cases where we need to perform two checks, I’d suggest something like this:
For the rest of the cases, I’d just check if one of the functions returns something and fall back to getReportName().
I’m not sure if this approach works for you, maybe you’ll have a better idea.
I’d prefer to avoid adding this logic to the compute function since it would make it too bloated, but that might also be a possible solution. We can discuss this tomorrow when you're back, just to make sure I didn't miss anything.
kstroz commentedon Oct 21, 2025
Another idea would be to change the getReportName() signature to getReportName(report, attributes, params?) and pass invoiceReceiverPolicy or parentReportActionParam in params.
To keep getReportName cleaner, since parentReportActionParam is returned in over 30 if statements, we could extract this logic before returning the new logic from design docs (reportAttributes[reportId].reportName || report.reportName).
It might also be a good idea to clean this up a bit, as this is one of the main reasons why getReportName() is currently so long.
We can also separate invoiceReceiverPolicy in the same way, although it’s only used in two if statements within the return. The only concern I have with this extraction is how much the order of the if statements in the current getReportName() matters.
26 remaining items
shubham1206agra commentedon Nov 25, 2025
@neil-marcellini Can you assign me this issue before I approve the PR?
neil-marcellini commentedon Dec 1, 2025
Closing this as explained here
neil-marcellini commentedon Dec 23, 2025
Reopening for C+ payment for @shubham1206agra's C+ review of this PR #75357
melvin-bot commentedon Dec 23, 2025
Triggered auto assignment to @laurenreidexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.laurenreidexpensify commentedon Dec 29, 2025
Payment Summary
garrettmknight commentedon Apr 2, 2026
$250 approved for @shubham1206agra