Skip to content

Conversation

@TaduJR
Copy link
Contributor

@TaduJR TaduJR commented Nov 26, 2025

Explanation of Change

This PR implements a group-by report layout feature that allows users to organize expense report transactions by Category or Tag, matching the familiar OldDot functionality that NewDot customers have been requesting.

Fixed Issues

$ #72100
$ #76079
$ #76082
$ #76084
$ #76085
$ #76087
$ #76091
PROPOSAL: #72100 (comment)

Tests

Desktop Testing

Category Grouping:

  1. Open an expense report with 5+ transactions across multiple categories (e.g., 2 "Gas" transactions, 3 "Office Supplies" transactions)
  2. Click More button
  3. Click "Report layout" in the menu
  4. Verify RHP opens with header "Report layout" and "Group by:" label
  5. Verify "Category" is selected by default (green checkmark)
  6. Verify transactions are grouped by category with group headers showing "Category Name - $Amount"
  7. Verify groups are sorted order on the category/tag values alphabetically (A>Z)
  8. Verify each group header has a checkbox
  9. Click a group header checkbox
  10. Verify all transactions in that group are selected
  11. Click individual transaction to deselect
  12. Verify group checkbox shows indeterminate state

Tag Grouping:

  1. With report still open, click More → "Report layout"
  2. Select "Tag" option
  3. Verify modal dismisses
  4. Verify transactions instantly regroup by tag
  5. Verify group headers now show tag names
  6. Verify untagged transactions show in separate group

Preference Persistence:

  1. Navigate to a different expense report
  2. Verify tag grouping is still active (preference persisted)
  3. Change back to category grouping
  4. Open a third report
  5. Verify category grouping is active

Offline Mode:

  1. Enable airplane mode (disconnect internet)
  2. Change grouping preference from category to tag
  3. Verify transactions regroup instantly (optimistic update)
  4. Disable airplane mode (reconnect internet)
  5. Wait ~5 seconds
  6. Verify preference remains as tag (synced to server)

Edge Cases:

  1. Open a report with only 1 transaction
  2. Verify "Report layout" option does NOT appear in More menu
  3. Open a report where all transactions have the same category
  4. Verify only one group appears
  5. Open a report with 0 transactions
  6. Verify "Report layout" option does NOT appear in three-dots menu

Mobile Testing (iOS/Android)

Category Grouping:

  1. Open an expense report with 5+ transactions on mobile device
  2. Tap More menu
  3. Verify "Report layout" option appears
  4. Tap "Report layout"
  5. Verify RHP opens with "Report layout" header and back button
  6. Verify "Group by:" label is visible
  7. Verify "Category" is selected by default
  8. Tap "Tag" option
  9. Verify modal dismisses and transactions regroup by tag
  10. Verify checkboxes are visible on group headers

Group Selection:

  1. Tap a group header checkbox
  2. Verify all transactions in that group are selected
  3. Verify group checkbox shows checked state
  4. Tap individual transaction checkbox to deselect one
  5. Verify group checkbox shows indeterminate state
  6. Tap group checkbox again
  7. Verify all transactions in group are deselected

Both Platforms Desktop and Mobile:

  1. Go to staging.new.expensify.com
  2. Go to 1:1 DM.
  3. Create two expenses.
  4. Open expense report.
  5. Verify No category checkbox should be hidden because we cannot select category for IOU expense.

Precondition:

Have a very long category - Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office Home Office H

  1. Go to staging.new.expensify.com

  2. Go to workspace chat.

  3. Create an expense with car category.

  4. Create an expense with a very long category.

  5. Open the expense report.

  6. Verify Long category should be truncated.

  7. Go to staging.new.expensify.com

  8. Go to workspace chat.

  9. Create an expense without category.

  10. Open the expense report.

  11. Go offline.

  12. Create another expense without category.

  13. Go online.

  14. Verify Expense without category should be grouped as "Uncategorized" when created offline.

  15. Go to staging.new.expensify.com

  16. Go to workspace chat.

  17. Create three expenses with different amount and category (category should not in alphabetical order).

  18. Open the expense report.

  19. Open the first expense.

  20. Navigate through the expenses with arrow on the top right.

  21. Verify Navigation via arrows should sync with the order of expenses in the expense report.

Precondition:

  1. Create a tag in A: B format in workspace settings > Tags.
  2. Go to staging.new.expensify.com
  3. Go to workspace chat.
  4. Create two expenses with tag in A: B format.
  5. Open the expense report.
  6. Click More > Report layout > Tag.
  7. Verify A: B tag will be displayed as A: B.

Precondition:

Workspace has multi-level independent tags.

  1. Go to staging.new.expensify.com

  2. Go to workspace chat.

  3. Create an expense with all tags selected.

  4. Create another expense with only the second tag selected.

  5. Open the expense report.

  6. Click More > Report layout > Tag.

  7. Verify Each tag will be followed by a comma.

  8. Verify There will be no colon in front of the tag if the previous tag is not selected.

  9. Go to staging.new.expensify.com

  10. Go to workspace chat.

  11. Create an expense without category.

  12. Open the expense report.

  13. Go offline.

  14. Create another expense without category.

  15. Go online.

  16. Verify Expense without category should be grouped as "Uncategorized" when created offline.

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified there are no new alerts related to the canBeMissing param for useOnyx
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@TaduJR TaduJR requested review from a team as code owners November 26, 2025 18:44
@melvin-bot
Copy link

melvin-bot bot commented Nov 26, 2025

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx ts-node ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx ts-node ./scripts/generateTranslations.ts --compare-ref main

@melvin-bot melvin-bot bot requested review from shubham1206agra and removed request for a team November 26, 2025 18:44
@melvin-bot
Copy link

melvin-bot bot commented Nov 26, 2025

@shubham1206agra Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot requested review from JmillsExpensify and removed request for a team November 26, 2025 18:44
@TaduJR TaduJR changed the title Feat cfi add group by report layout feature feat: [CFI] Add group-by report layout feature Nov 26, 2025
@codecov
Copy link

codecov bot commented Nov 26, 2025

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/CONST/index.ts 85.84% <ø> (ø)
src/ONYXKEYS.ts 100.00% <ø> (ø)
src/SCREENS.ts 100.00% <ø> (ø)
src/libs/Navigation/linkingConfig/config.ts 75.00% <ø> (ø)
src/styles/index.ts 45.65% <ø> (ø)
src/ROUTES.ts 12.20% <0.00%> (-0.02%) ⬇️
...gation/AppNavigator/ModalStackNavigators/index.tsx 8.41% <0.00%> (-0.02%) ⬇️
src/libs/ReportSecondaryActionUtils.ts 90.73% <87.50%> (-0.08%) ⬇️
src/components/MoneyReportHeader.tsx 0.17% <0.00%> (-0.01%) ⬇️
src/libs/TagUtils.ts 0.00% <0.00%> (ø)
... and 5 more
... and 33 files with indirect coverage changes

@github-actions
Copy link
Contributor

🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here.

Copy link
Contributor

@JmillsExpensify JmillsExpensify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from a product perspective.

@mountiny mountiny marked this pull request as draft November 26, 2025 19:57
@mountiny mountiny marked this pull request as ready for review November 26, 2025 19:57
@melvin-bot melvin-bot bot requested a review from nkuoch November 26, 2025 22:11
Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TaduJR Changes look good, but why are there no unit tests? All the helper method and actions for the api should be covered with extensive unit testing. @shubham1206agra you should not be approving prs that do not have the tests ready for future.

@TaduJR please add the tests for all the methods and actions in a follow up

Comment on lines +606 to +609
// Exclude IOU reports - only show for workspace expense reports
if (isIOUReportUtils(report)) {
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this if you have that

if (!isExpenseReportUtils(report)) {
        return false;
    }

Check in place already

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isExpenseReport is true for all money request reports (including IOU/DM), and we explicitly need to exclude IOU. So we need both.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these methods should be unit tested

@Krishna2323
Copy link
Contributor

JUST TO NOTE: We are missing the “group by” label, and I feel the offline scenarios are not aligned in one edge case. For example, we have three transactions but two of them have a pending delete status — in this case, the grouping is still shown and we also show the “Report layout” option. I’m not sure what the expected behavior should be, but I think it’s an edge case and not a blocker for now.

@TaduJR
Copy link
Contributor Author

TaduJR commented Nov 26, 2025

@TaduJR Changes look good, but why are there no unit tests? All the helper method and actions for the api should be covered with extensive unit testing.

Hey @mountiny. I already asked to continue working on unit tests but I thought they were not needed since the feature was needed immediately. Even asked here before #72943 (comment)

@TaduJR
Copy link
Contributor Author

TaduJR commented Nov 26, 2025

We are missing the “group by” label

@Krishna2323 I fixed that incase you missed it

@mountiny
Copy link
Contributor

@TaduJR thanks for the context, lets follow up with the tests soon 🙌 thank you

@TaduJR
Copy link
Contributor Author

TaduJR commented Nov 26, 2025

@TaduJR please add the tests for all the methods and actions in a follow up

Thanks will do that. As I told you before I thought they were not needed after my comment here #72943 (comment) got jumped accidentally.

@TaduJR
Copy link
Contributor Author

TaduJR commented Nov 26, 2025

@TaduJR thanks for the context, lets follow up with the tests soon 🙌 thank you

Sure thing @mountiny

@mountiny
Copy link
Contributor

Already wrote most of them actually.

Ok, but I am not sure why would you not include them in the PR if you already had some written? Better to have some than none

@TaduJR
Copy link
Contributor Author

TaduJR commented Nov 26, 2025

Ok, but I am not sure why would you not include them in the PR if you already had some written?

Thats because I was not sure about all the unit tests are doing whats expected, since I choose to make the feature perfect then write the test then after some rush it got merged

But will choose TDD after now.

@mountiny
Copy link
Contributor

Sounds great, next, lets focus on any blockers that might arise to fix them quickly or demote tomorrow. Thanks for the hard work!

@mountiny mountiny merged commit cdf94da into Expensify:main Nov 26, 2025
34 of 36 checks passed
@TaduJR
Copy link
Contributor Author

TaduJR commented Nov 26, 2025

Awesome

@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.2.65-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@trjExpensify
Copy link
Contributor

trjExpensify commented Nov 27, 2025

BUG: No amounts in the category sub-header (same with tag)

image image image

@mountiny
Copy link
Contributor

That is intentional for this v1 to get it out asap

@trjExpensify
Copy link
Contributor

Oh hm, is there a PR for the v2? 😕

@TaduJR
Copy link
Contributor Author

TaduJR commented Nov 27, 2025

Yea Unfortunately the convertedAmount field was a bit problematic, then we decided to got without subtotal and hold it in v2.

Ref: https://expensify.slack.com/archives/C01GTK53T8Q/p1764158298659759

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/marcaaron in version: 9.2.65-6 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants