-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cleanup: consolidate all getFilteredOptions
and getOptions
calls into one function getOptions
#53056
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing searchValue: ''
will make userToInvite
always null because it will return early here
App/src/libs/OptionsListUtils.ts
Lines 1019 to 1021 in b550938
if (!searchValue || isCurrentUserLogin || isInSelectedOption || (!isValidEmail && !isValidPhoneNumber && !shouldAcceptName) || isInOptionToExclude || excludeUnknownUsers) { | |
return null; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well!
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
🎯 @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
OptionListUtils
needs 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 insteadgetOptions
is directly exposed.searchValue
fromgetOptions
as there was no code path that uses this parameter anymore. For filtering by a search value we should usefilterOptions
Fixed 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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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