-
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
Migrate withWritableReportOrNotFound from withOnyx to useOnyx #49200
Migrate withWritableReportOrNotFound from withOnyx to useOnyx #49200
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
Reviewer Checklist
Screenshots/VideosAndroid: Native49200_android_native.movAndroid: mWeb Chrome49200_android_web.moviOS: Native49200_ios_native.moviOS: mWeb SafariMacOS: Chrome / Safari49200_web_chrome.movMacOS: Desktop49200_web_desktop.mov |
Hi @brunovjk , for some reason I'm unable to re-trigger CLA assistant pipeline. Kindly help |
I had to answer an urgent issue. I'll come back here today and help you with that. Thank you. |
I'm dealing with some problems with my internet. I'll come back here as soon as I resolve it. |
@abhinaybathina Sorry for the delay, we're in full swing now! I had an error when trying to submit a simple expense: Screen.Recording.2024-09-19.at.13.39.07.movCould you please 'merge main' to update, so I can test again. Thanks a lot. |
@brunovjk Sure checking |
0b93754
to
90968b8
Compare
Hey @abhinaybathina, great work on the PR! I have a couple of suggestions:
Also, could you fill the "Screenshots/Videos" section demonstrating your test steps? Thanks! |
That's a good catch, fixed it now. Thank you so much! |
@brunovjk I've added a video too, can you please check? |
Hey @abhinaybathina, Great work! Excuse but I have a couple of suggestions:
Thanks! |
… of 1 for missing reportID
Done @brunovjk. Thanks! |
@abhinaybathina can you do a distance request? Screen.Recording.2024-09-20.at.08.42.48.movI couldn't figure out why this is happening, in my local |
Even I too thought of this solution, either way is fine. Should I make this change? |
Since we need a default value only for this function call, we can even make it simpler by just doing this. What do you think?
|
Ok, I did a quick test and I liked, can you made all those changes? Do not need to run, I will back to it tomorrow. Let's test carefully. Thank you. |
…UserPerformWriteAction function only
Thank you for your quick reply. Pushed the changes. No worries, you can review tomorrow! |
@@ -54,16 +51,23 @@ export default function <TProps extends WithWritableReportOrNotFoundProps<MoneyR | |||
shouldIncludeDeprecatedIOUType = false, | |||
): React.ComponentType<Omit<TProps & RefAttributes<TRef>, keyof WithWritableReportOrNotFoundOnyxProps>> { | |||
// eslint-disable-next-line rulesdir/no-negated-variables | |||
function WithWritableReportOrNotFound(props: TProps, ref: ForwardedRef<TRef>) { | |||
const {report = {reportID: ''}, route, isLoadingApp = true, reportDraft} = props; | |||
function WithWritableReportOrNotFound(props: Omit<TProps, keyof WithWritableReportOrNotFoundOnyxProps>, ref: ForwardedRef<TRef>) { |
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.
We must remove OnyxProps https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#hooks-and-hocs
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
@brunovjk If we do this, the components which are wrapped using this HOC will be receiving the props (route, report and reportDraft) but since we are removing the type for onyx props it'll show type errors in all the components like this |
I see, it was just a suggestion, we should guide ourselves here https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#hooks-and-hocs |
Understood, let me check again |
cbd7c61
to
edf4ee7
Compare
@brunovjk, I don't think the props should be removed from here. The guide here shows the example of a functional component. I completely agree that we need to remove the onyx props in this case as we don't need it further. But the changes we are making right now is a HOC itself which provides the props to the wrapped component. In this case, we need the correct typing of the props or else it may cause type error issues in the wrapped components as we've seen in the attached image above. I am going through withPolicy.tsx file right now and have found that the same implementation has been done there also. I believe that what we already did is right and we shouldn't remove onyx props in this case. Thanks! |
I see, what do you think @blazejkustra and @roryabraham? We could indeed leave it as |
I think what we have here is fine. The Onyx props are still separate from other props in a HOC because they are passed to the wrapped component |
Great, Thank you! I will complete the checklist later today. |
Looks like a problem with the lint-changed lint action because it's reporting on files that weren't changed. Going to ignore and merge |
@roryabraham looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
✋ 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/roryabraham in version: 9.0.41-0 🚀
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.0.41-10 🚀
|
Details
Fixed Issues
$ #49110
PROPOSAL: #49110 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.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
Screen.Recording.2024-09-21.at.1.56.52.AM.mov
Android: mWeb Chrome
Screen.Recording.2024-09-21.at.1.59.11.AM.mov
iOS: Native
Screen.Recording.2024-09-20.at.9.15.18.PM.mov
iOS: mWeb Safari
Screen.Recording.2024-09-21.at.2.09.28.AM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-09-20.at.12.29.24.AM.mov
MacOS: Desktop
Screen.Recording.2024-09-21.at.2.15.22.AM.mov