-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
clean: moved Category OptionListUtils over to CategoryOptionListUtils #52250
Conversation
f7635a3
to
1aebb87
Compare
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.
Looking good, few clarifying comments first
if (numberOfEnabledCategories < CONST.CATEGORY_LIST_THRESHOLD) { | ||
const data = getCategoryOptionTree(filteredCategories, false, selectedOptionsWithDisabledState); | ||
categorySections.push({ | ||
// "All" section when items amount less than the threshold |
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.
Could you explain this comment?
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.
Oh I see, these are the sections comments- maybe instead of const data
we should use the variable name to make this clearer
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.
hm agree, this is just copied over code from how it was previously used. Do we need to make this change in this PR?
@@ -0,0 +1,282 @@ | |||
// eslint-disable-next-line you-dont-need-lodash-underscore/get |
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.
why do we need lodash get here?
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.
to be fair, idk, this is copied over from the previously existing code. I think the lodashGet function simplifies a rather complicated nested lookup for us here (we'd need to write our own helper function for this case)
Assigning @ahmedGaber93 from the issue |
Reviewer Checklist
Screenshots/VideosAndroid: Native20241113121125823.mp4Android: mWeb Chrome20241113121455360.mp4iOS: Native20241113113737065.mp4iOS: mWeb Safari20241113113118044.mp4MacOS: Chrome / Safari20241113111351972.mp420241113112519895.mp4MacOS: Desktop20241113121538660.mp4 |
I think we need to rename file |
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! Just small change is needed here #52250 (comment)
🎯 @ahmedGaber93, thanks for reviewing and testing this PR! 🎉 An E/App issue has been created to issue payment here: #52500. |
const smallWrongSearchResultList: OptionsListUtils.CategoryTreeSection[] = [ | ||
const smallWrongSearchResultList: OptionsListUtils.CategorySection[] = [ |
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.
Hmm! I think this part may still need more cleans, we use type CategorySection[]
in tags and other places that not related to categories. I think we can rename CategorySection
. It is not having any attributes related to category, it is just related to it is a section. WDYT?
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.
yeah, let me think about the naming. I think there the word "Category" is used here in two different senses. agree, lets get clear on the naming!
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.
agree, renamed it to Section
👍
All yours. @grgia |
✋ 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/grgia in version: 9.0.66-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.0.66-8 🚀
|
Explanation of Change
While working on performance fixes for the search over at this PR I touched the
OptionListUtils
a lot, specifically thegetOptions
andfilterOptions
functions.It occurs to me that the
getOptions
function became a god-function that serves a lot of different use-cases, has a lot of responsibilities and is quite coupled with a lot of other places in the code. The wholeOptionListUtils
is over 2.5k lines long and hard to understand.Right in the beginning of the
getOptions
function there are a few early return statements for certain cases. My plan is to refactor all those use-cases out into their own functions, as there is no use in adding aincludeXYC
parameter togetOptions
just to do:The first use case I tackled is moving the category option list into its own utility.
Fixed Issues
$ #51954
PROPOSAL: #51954 (comment)
Tests
Offline tests
Same as testing
QA Steps
Same as testing
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-08.at.12.57.33.mp4
Android: mWeb Chrome
CleanShot.2024-11-08.at.12.57.33.mp4
iOS: Native
CleanShot.2024-11-08.at.12.57.33.mp4
iOS: mWeb Safari
CleanShot.2024-11-08.at.12.57.33.mp4
MacOS: Chrome / Safari
CleanShot.2024-11-08.at.12.57.33.mp4
MacOS: Desktop
CleanShot.2024-11-08.at.12.57.33.mp4