-
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
[TS migration] Migrate 'SettlementButton.js' component to TypeScript PART-2 #35877
[TS migration] Migrate 'SettlementButton.js' component to TypeScript PART-2 #35877
Conversation
@hoangzinh 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] |
@hoangzinh |
src/components/SettlementButton.tsx
Outdated
@@ -49,7 +49,7 @@ type SettlementButtonProps = SettlementButtonOnyxProps & { | |||
chatReportID?: string; | |||
|
|||
/** The IOU/Expense report we are paying */ | |||
iouReport?: OnyxEntry<Report> | EmptyObject; | |||
iouReport?: OnyxEntry<Report> | Report | EmptyObject; |
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.
it looks weird to have both OnyxEntry<Report>
and Report
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 fact, I did this more for clarification
Since we can pass both these types
But this does not affect typing
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.
But I can delete)
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.
Done )
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-02-06.at.16.59.22.android.movAndroid: mWeb ChromeScreen.Recording.2024-02-06.at.17.01.54.android.chrome.moviOS: NativeScreen.Recording.2024-02-06.at.17.08.35.ios.moviOS: mWeb SafariScreen.Recording.2024-02-06.at.17.07.42.ios.safari.movMacOS: Chrome / SafariScreen.Recording.2024-02-06.at.16.50.10.web.movMacOS: DesktopScreen.Recording.2024-02-06.at.17.02.58.desktop.mov |
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.
Jumping in early to fix the typecheck failing on main
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@@ -197,7 +197,7 @@ function SettlementButton({ | |||
} | |||
|
|||
if (iouPaymentType === CONST.IOU.REPORT_ACTION_TYPE.APPROVE) { | |||
IOU.approveMoneyRequest(iouReport); | |||
IOU.approveMoneyRequest(iouReport ?? {}); |
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.
@ZhenjaHorbach @mountiny
shouldn't this be moved to the if check? Are we sure we want to pass in an empty object to that function when the report action type is approved
and I would assume - ready to process? Seems some of the keys would end up like report_undefined
etc.
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 theory this may never happen )
But following the iouReport typing it can be null
And you mean not call IOU.approveMoneyRequest when iouReport is empty ?
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.
well imo if that can happen the function should handle such case.
also, if it can be null
as you say, it will crash, if you attempt to access any props on it
I am not familiar with this part of the code, just stumbled upon that today when we were fixing the latest main merge on a different pr so I am not sure if not calling IOU.approveMoneyRequest
in such case is valid, just applying some logic here, but it might be flawed as stated above.
🚀 Deployed to staging by https://github.com/mountiny in version: 1.4.38-0 🚀
|
🚀 Deployed to staging by https://github.com/mountiny in version: 1.4.38-0 🚀
|
🚀 Deployed to production by https://github.com/marcaaron in version: 1.4.38-6 🚀
|
Details
Fixed Issues
$ #25100
PROPOSAL: #25100 (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 methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.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 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-01-03-at-160854_EbleMEvi.mp4
Android: mWeb Chrome
android-web_4bVb1NIW.mp4
iOS: Native
ios_4Ez0lS3G.mp4
iOS: mWeb Safari
ios_iC6C6JXX.mp4
MacOS: Chrome / Safari
web_frW2qrPs.1.mp4
MacOS: Desktop
desktop_YabzuIQv.mp4