cleanup: consolidate all getFilteredOptions and getOptions calls into one function getOptions#53056
Conversation
|
@aldo-expensify 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] |
|
cc @ahmedGaber93 since you've reviewed all cleanup and the main PR so far |
|
Reviewing today |
src/libs/OptionsListUtils.ts
Outdated
| searchValue, | ||
| searchValue: '', |
There was a problem hiding this comment.
Passing searchValue: '' will make userToInvite always null because it will return early here
App/src/libs/OptionsListUtils.ts
Lines 1019 to 1021 in b550938
There was a problem hiding this comment.
Good catch, thats interesting, because that means that this is probably also an unused code path. (Almost) all code paths before were just passing searchValue: '' to getFilteredOptions, making it early return as well.
Will carefully double check to see if it can be removed / needs to be treated differently
There was a problem hiding this comment.
userToInvite is only generated from a user's search input. As we removed the searchValue from getOptions we don't need to keep the code for userToInvite there.
Please check this commit d3ef36e
Seems to work (but would appreciate a careful double check from your side):
| return optionList; | ||
| }, [action, areOptionsInitialized, betas, didScreenTransitionEnd, iouType, isCategorizeOrShareAction, options.personalDetails, options.reports, participants, isPaidGroupPolicy]); | ||
| }, [action, areOptionsInitialized, betas, didScreenTransitionEnd, iouType, isCategorizeOrShareAction, options.personalDetails, options.reports, participants]); | ||
|
|
There was a problem hiding this comment.
I think we may miss the sorting by type here after removing sortByReportTypeInSearch: isPaidGroupPolicy
I noticed ordering change between this PR and staging
20241126163546271.mp4
There was a problem hiding this comment.
okay, addressed the ordering as well.
Note: there are now two places where we explicitly call .orderOptions. In the next PR i will finally separate the filtering and ordering in a clean manner. So this redundancy will go away in the next PR
Reviewer Checklist
Screenshots/Videos |
getFilteredOptions and getOptions calls into one function getOptions
|
🎯 @ahmedGaber93, thanks for reviewing and testing this PR! 🎉 An E/App issue has been created to issue payment here: #53242. |
|
🚀 Deployed to staging by https://github.com/aldo-expensify in version: 9.0.69-1 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.0.69-4 🚀
|






























Explanation of Change
While working on performance improvements at this PR:
I noticed that the
OptionListUtilsneeds a few cleanups before I can move on with the performance improvements.In this PR I:
getFilterOptions(which was marked as discouraged to use anyway) and insteadgetOptionsis directly exposed.searchValuefromgetOptionsas there was no code path that uses this parameter anymore. For filtering by a search value we should usefilterOptionsFixed Issues
$ #51954 (comment)
PROPOSAL: #51954 (comment)
Tests
Test that all search features are still working.
Offline tests
QA Steps
Test that all search features are still working.
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))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
CleanShot.2024-11-25.at.16.17.02.mp4
Android: mWeb Chrome
CleanShot.2024-11-25.at.16.17.02.mp4
iOS: Native
CleanShot.2024-11-25.at.16.17.02.mp4
iOS: mWeb Safari
CleanShot.2024-11-25.at.16.17.02.mp4
MacOS: Chrome / Safari
CleanShot.2024-11-25.at.16.17.02.mp4
MacOS: Desktop
CleanShot.2024-11-25.at.16.17.02.mp4