-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Simplyfy computation of report name for certain types #81513
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
base: main
Are you sure you want to change the base?
Simplyfy computation of report name for certain types #81513
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 390694dca4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
neil-marcellini
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start - a couple things.
| /** | ||
| * Reports with certain types do not require name computation and static value can be used. | ||
| */ | ||
| function shouldReturnStaticReportName(report: Report) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally I think we need to verify that the report is linked to a policy that has a text_title field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise the name would not be computed and would be set to some default. Actually, I'm not sure what the default behavior is.
On both Classic and New Expensify, can you try creating unreported reports (reports not on a policy), for all the custom name types, and verify they have a report.reportName set. If so then we don't need to check this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I am not sure how to create report of each of these type.
When I click "create expense" my report gets type chat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- For invoice I don't know what is create path
- for
unsupported typesI guess there is no possibility to create these in NewDot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, yeah, looks like we should only do the early return for expense reports, because Invoice has special computation and the other types are not supported in NewDot currently. Given that expense reports are a majority of reports, I think it'll still be a significant improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll leave only TYPE.EXPENSE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 674ad74aea
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (report?.reportName && shouldReturnStaticReportName(report)) { | ||
| return isArchivedNonExpense ? generateArchivedReportName(report?.reportName) : report?.reportName; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve new‑dot invoice naming logic
For invoice reports, this early return now bypasses getInvoiceReportName, which intentionally ignores report.reportName for new‑dot invoices (it uses isNewDotInvoice(...) to compute a money‑request style name). If a new‑dot invoice still has a legacy reportName populated, the UI will now display that stale/old‑dot name instead of the computed payer/amount format. This shows up specifically for invoice reports whose chatReportID points to an invoice room (new‑dot) and reportName is present.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neil-marcellini there is complex computation of name for invoice reports done later in computeReportName. I'm starting to doubt if our early check can be done so easily
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also tests are failing with this check so there is something I'm missing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned before, I'll leave only TYPE.EXPENSE on our early return check
|
(Neil's AI agent) @sosek108 Here are manual test steps for creating each custom name report type, to verify 1. Expense (
|
neil-marcellini
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the investigation. It looks like we should only skip the computation for expense reports and call it good.
| /** | ||
| * Reports with certain types do not require name computation and static value can be used. | ||
| */ | ||
| function shouldReturnStaticReportName(report: Report) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Neil's AI agent) Given the invoice issue below, remove INVOICE from this list. That also resolves the text_title question -- the remaining types (expense, bill, paycheck, trip) reliably get their name from the backend formula. I posted detailed test steps for each type as a separate PR comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned before, I'll leave only TYPE.EXPENSE on our early return check
| /** | ||
| * Reports with certain types do not require name computation and static value can be used. | ||
| */ | ||
| function shouldReturnStaticReportName(report: Report) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, yeah, looks like we should only do the early return for expense reports, because Invoice has special computation and the other types are not supported in NewDot currently. Given that expense reports are a majority of reports, I think it'll still be a significant improvement.
sosek108
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left only TYPE.EXPENSE in early return. Although tests are failing so I'll be investigating this
| /** | ||
| * Reports with certain types do not require name computation and static value can be used. | ||
| */ | ||
| function shouldReturnStaticReportName(report: Report) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll leave only TYPE.EXPENSE
| /** | ||
| * Reports with certain types do not require name computation and static value can be used. | ||
| */ | ||
| function shouldReturnStaticReportName(report: Report) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned before, I'll leave only TYPE.EXPENSE on our early return check
| if (report?.reportName && shouldReturnStaticReportName(report)) { | ||
| return isArchivedNonExpense ? generateArchivedReportName(report?.reportName) : report?.reportName; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned before, I'll leave only TYPE.EXPENSE on our early return check


Explanation of Change
Add early return to computeReportName for report of types:
These types does not require frontend computation, as their value is stored in
reportNameFixed Issues
$ #81339
PROPOSAL:
Tests
Offline tests
N/A
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari