Decode category/tag strings before grouping in report layout#85603
Draft
Decode category/tag strings before grouping in report layout#85603
Conversation
Transactions with the same category but different HTML encoding (e.g., Uber & car washes vs Uber & car washes) were being grouped separately in the expense report view, despite displaying the same group name. This happened because the raw category string was used as the Map key for grouping, while the displayed name was HTML-decoded. Now we decode category/tag strings before using them as grouping keys, matching how OldDot already handles this in lib_report.js. Related Expensify/Expensify#612034 Co-authored-by: Lydia Barclay <lydiabarclay@users.noreply.github.com>
Contributor
Author
|
The failing Root cause: The Grails Maven repository ( Evidence: This PR only modifies TypeScript files ( Recommendation: Re-run the failed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
When expenses share the same category but are stored with different HTML encodings (e.g.,
Uber & car washesvsUber & car washes), the report view in New Expensify displays them as two separate category groups — even though they look identical. This happens becausegroupTransactionsByCategoryinReportLayoutUtils.tsuses the raw category string as theMapkey for grouping, but displays the HTML-decoded name. Different code paths (MCC auto-categorization vs. distance default category) can produce the same category name with different HTML encoding, particularly for the&character.The fix decodes the category string before using it as the grouping key, so that
&and&resolve to the same group. The same fix is applied togroupTransactionsByTagfor consistency. This matches how OldDot already handles this inlib_report.jswith_.unescape().Fixed Issues
$ https://github.com/Expensify/Expensify/issues/612034
Tests
&in the category string and the other has a literal&Offline tests
N/A — this change is purely about how transactions are grouped in memory for display. Offline behavior is unchanged.
QA Steps
&character (e.g., "Auto - 6340 (including Tolls, Parking, Uber & car washes)")PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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
N/A — no UI changes, logic-only fix in grouping utility
Android: mWeb Chrome
N/A — no UI changes, logic-only fix in grouping utility
iOS: Native
N/A — no UI changes, logic-only fix in grouping utility
iOS: mWeb Safari
N/A — no UI changes, logic-only fix in grouping utility
MacOS: Chrome / Safari
N/A — no UI changes, logic-only fix in grouping utility