-
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
cleanup: moved report field options to their own file #52311
cleanup: moved report field options to their own file #52311
Conversation
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.
One NAB question, otherwise looks good!
policyReportFieldOptions: validFieldOptions, | ||
recentlyUsedPolicyReportFieldOptions: recentlyUsedOptions, | ||
options: validFieldOptions, | ||
recentlyUsedOptions, |
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.
NAB - Should we re-order these to match the params better, and not have to name them? I could go either way
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.
sorry not sure what you mean, you mean that we rename validFieldOptions
to options
so we don't have to specify the object property - or to not use an object for the getReportFieldOptionsSection
but separate parameters?
I think we have no style guideline on that but as soon as a function takes more than three parameters I usually create an object type as single parameter. For me this helps with readability, understanding what other options you can pass without opening the function declaration (intelli sense) and avoid having to pass undefined
as a parameter explicitly when when we want to skip passing a certain parameter
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 i think that's fine! I just meant that the order they're listed in the function definition is different than the order we're passing them here. But it's not a huge deal, no need to change
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
✋ 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/dangrous in version: 9.0.61-0 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.61-3 🚀
|
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:In this PR we moves the report fields to their own
ReportFieldOptionsListUtils
.Related to:
Fixed Issues
$ #51954
PROPOSAL: #51954 (comment)
Tests
Offline tests
Same as tests
QA Steps
Same as tests
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-11.at.15.05.41.mp4
Android: mWeb Chrome
CleanShot.2024-11-11.at.15.05.41.mp4
iOS: Native
CleanShot.2024-11-11.at.15.05.41.mp4
iOS: mWeb Safari
CleanShot.2024-11-11.at.15.05.41.mp4
MacOS: Chrome / Safari
CleanShot.2024-11-11.at.15.05.41.mp4
MacOS: Desktop
CleanShot.2024-11-11.at.15.05.41.mp4