[Search v1] Add sorting #42248
Conversation
b07ba13 to
0dea1c3
Compare
8c435c6 to
fe5cd89
Compare
fe5cd89 to
62dc109
Compare
|
@luacmartins This is my first approach to this: https://github.com/Expensify/App/pull/42248/files#diff-4e6d1f540181229a6bc7bd2f96266c9b76bc05cf86150ea1e225c657d358aafbR54 However there are 2 problems with this approach:
Examples:
Currently I see no other reasonable solution than a chain of Do you see any other solution and what way do you want me to move forward? Feel free to check the draft PR - everything else should be working |
|
@rayane-djouah 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] |
8750a91 to
6e379da
Compare
|
@shawnborton in here is the fix for #42269 I added this to "test steps" for the reviewer. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪
|
|
I don't have any more visual bugs to report (cc @Expensify/design in case you run into anything though), but one thing I did notice was that it doesn't feel like the sorting behavior is actually correct. For instance, if I sort by amount - descending, it seems to be okay but then as I scroll down the list, I see some larger amounts start to appear and it feels like the sorting almost starts over again. Any ideas what's going on there? |
Agree!
I actually think you should be able to sort by action and type. For example, I might want to sort by action so that all the expenses with a "Pay" button show in a group. Same with type. I don't see why we wouldn't let you sort by those two.
Same here. I'm noticing this with most of the sortable fields, not just Total. |
Yeah actually that's a totally valid point, I agree with you! |
6f5946b to
2fd1c57
Compare
|
@luacmartins @c3024 The biggest changes are:
@luacmartins for now the
Please review :) |
|
Thanks @Kicu! Not sure if we wanna sort by receipts or not, but we can definitely go ahead without sorting that for now. As for reports, we landed on no sorting for now, so all good there. |
|
LGTM this is still a thing that we should address in a follow up |
|
@c3024 can you review again please? |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariaddSort.mp4MacOS: DesktopaddSortDesktop.mp4 |
|
There are cases of |
|
✋ 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/luacmartins in version: 1.4.77-11 🚀
|
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 1.4.77-11 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.78-5 🚀
|
| { | ||
| columnName: CONST.SEARCH_TABLE_COLUMNS.MERCHANT, | ||
| translationKey: 'common.merchant', | ||
| shouldShow: (data: OnyxTypes.SearchResults['data']) => SearchUtils.getShouldShowMerchant(data), |
There was a problem hiding this comment.
This might have caused this issue #43205 fixed here https://github.com/Expensify/App/pull/43206/files
| [CONST.SEARCH_TABLE_COLUMNS.CATEGORY]: 'category' as const, | ||
| [CONST.SEARCH_TABLE_COLUMNS.TYPE]: 'type' as const, | ||
| [CONST.SEARCH_TABLE_COLUMNS.ACTION]: 'action' as const, | ||
| [CONST.SEARCH_TABLE_COLUMNS.DESCRIPTION]: null, |
| const hash = SearchUtils.getQueryHash(query, policyIDs, sortBy, sortOrder); | ||
| const [currentSearchResults, searchResultsMeta] = useOnyx(`${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`); | ||
|
|
||
| // save last non-empty search results to avoid ugly flash of loading screen when hash changes and onyx returns empty data |


Details
formatted**fields are so that we are guaranteed that the values we sort by are the same as values that are actually displayed for the user, so I compute them in thegetSectionsfunction; date needs a bit of special handling because we need different date representation for sorting and different for displayFixed Issues
$ #39892
$ #42269
PROPOSAL:
Tests
Settings > Troubleshoot > New Search Page(NOTE: right now search works only on staging api) or go to[...]/search/allURLOffline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
rec-web-sorting-v2.mp4
MacOS: Desktop