-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Refactor ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS in src/libs/actions/Task.ts #70139
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
Conversation
|
@DylanDylann 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] |
c689a4a to
44b00a1
Compare
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
|
@parasharrajat Please merge the latest main |
|
Done. |
src/libs/actions/Task.ts
Outdated
| // allReportNameValuePair is used on getFinishOnboardingTaskOnyxData to generate Onyx optimistic data | ||
| Onyx.connectWithoutView({ |
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 should make getFinishOnboardingTaskOnyxData a pure function since this function is in an action file that could be connected to a view in the future.
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.
@luacmartins They don’t return data directly for rendering. If it’s purely related to an action (with no connection to UI)
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.
IMO, it’s fine to use connectWithoutView in this case. If you’re not comfortable with it, we can start a thread in the newdot room to discuss this further and decide on a consistent approach for similar cases in the future.
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 disagree. This is an action file that's not tied to network, pusher, etc. This function could very easily be added to a view where it's used for rendering. I think the general rule is that if it's an action file not tied to one of the pre-defined exceptions (online/offline listeners, pusher events, network requests) we should make it a pure function. Any exceptions to that case should be discussed and agreed upon.
cc @tgolen since we discussed this
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.
In this case, allReportNameValuePair isn’t used for rendering the UI. We only use it to build optimistic data, which is fetched when the user performs an action that triggers it. Therefore, we don’t need to worry about outdated data here. That’s why I suggest to use connectWithoutView. I’d love to hear more of your thoughts on this matter
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.
@DylanDylann you are right and I agree that it technically meets the bar for using connectWithoutView here, but I think from a bigger picture, we really want to promote the code using the best patterns.
I think connectWithoutView is best used in src/lib files, and the src/action files should try to stick to pure functions as much as possible. This way, people don't see the Onyx.connect pattern in the action files and aren't as tempted to copy it to some other spot, or begin referencing the impure function without realizing it.
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.
@tgolen Thanks for the explanation.
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.
@parasharrajat Could you update the PR?
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.
Updated. Thanks for waiting.
|
bump @parasharrajat Will you be able to update the PR soon? |
|
I was out sick for the last 2 days. So I couldn't update. I will work on it soon. |
|
@parasharrajat I'm sorry you haven't been feeling well. Will you have a chance to look at this soon? |
|
Yes, I will check it today. |
|
@parasharrajat did you get a chance to check this PR? |
|
I have started working on more refactors. I will start pushing updates shortly. |
|
Thanks @parasharrajat |
|
Hi @parasharrajat any update here? |
|
It's updated. Thanks for waiting. I was occupied with some urgent task follow-ups. |
|
@DylanDylann Should I add test steps for this, or will it be no QA? |
|
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
luacmartins
left a 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.
LGTM. Thanks for addressing the comments
|
@DylanDylann do you want one last look at this before merging? |
DylanDylann
left a 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.
LGTM
@parasharrajat Yes, please add a sample flow to the QA step |
|
Update QA steps to test basic flows. |
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.2.22-1 🚀
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.2.22-6 🚀
|
Explanation of Change
Fixed Issues
$ #67798
PROPOSAL:
Tests
Offline tests
QA Steps
_Note: Steps do not indicate the process of getting both of following tasks in the account. Please follow the standard test steps for getting these tasks _
Test drive task.
track and manage expensepurpose or some other purpose which creates the test drive task in the account.Setup Categories task.
#adminsor the concierge report.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)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
MacOS: Desktop