Refactored localeCompare in SearchQueryUtils - #66990
Conversation
|
@DylanDylann 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] |
Reviewer Checklist
Screenshots/VideosScreen.Recording.2025-07-30.at.16.37.05.movAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
| expect(sortedOptions).toEqual([CONST.SEARCH.CATEGORY_EMPTY_VALUE, 'A', 'B', 'C']); | ||
| }); | ||
|
|
||
| it('should not change order of non-empty values', () => { |
There was a problem hiding this comment.
This reads a little misleading to me, or maybe I'm not quite understanding what you mean. The order of the non-empty values does change (from BAC to ABC). Maybe this should be called "should sort non-empty values properly" or something like that?
| * @private | ||
| * This is a custom collator only for testing purposes. | ||
| */ | ||
| const customCollator = new Intl.Collator('en', {usage: 'sort', sensitivity: 'variant', numeric: true, caseFirst: 'upper'}); |
There was a problem hiding this comment.
Since this is duplicated, I have a couple of suggestions:
- Define it in
CONST(which isn't great because@privatedesignation won't be as effective - Export it from
src/libs/SearchQueryUtils.tswith an explicit comment saying it's only being exported so that tests can access it and it shouldn't be used otherwise - Define it in its own file somewhere and then import it into this test and
SearchQueryUtils.ts
There was a problem hiding this comment.
Let's keep these declaration different. As otherwise, I would have to break private assumption of the variable. And I don't want to do that as I don't trust any contributor of not mishandling the variable given I saw way too many people doing anti-patterns.
There was a problem hiding this comment.
OK, sounds good. I agree with that argument.
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/tgolen in version: 9.1.88-0 🚀
|
|
🚀 Deployed to production by https://github.com/grgia in version: 9.1.88-3 🚀
|
Explanation of Change
Fixed Issues
$ #66325
Tests
Offline tests
Same as Tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as Tests
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))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
Screen.Recording.2025-07-29.at.9.52.58.PM.mov
Android: mWeb Chrome
Screen.Recording.2025-07-29.at.8.47.00.PM.mov
iOS: Native
Screen.Recording.2025-07-29.at.9.00.29.PM.mov
iOS: mWeb Safari
Screen.Recording.2025-07-29.at.8.37.02.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2025-07-29.at.8.29.38.PM.mov
MacOS: Desktop
Screen.Recording.2025-07-29.at.8.52.43.PM.mov