Align default IDs in ReportUtils file#54297
Conversation
…efault-id # Conflicts: # src/libs/ReportUtils.ts
…efault-id # Conflicts: # src/libs/PolicyUtils.ts
|
|
||
| const moneyRequestReportID = originalMessage?.IOUReportID ?? -1; | ||
| const moneyRequestReportID = originalMessage?.IOUReportID; | ||
|
|
||
| if (!moneyRequestReportID) { |
There was a problem hiding this comment.
It looks like before moneyRequestReportID always was a truly value. So this condition never worked. Should I remove it maybe?
There was a problem hiding this comment.
I think it's better to keep it.
…efault-id # Conflicts: # src/libs/ReportUtils.ts
…efault-id # Conflicts: # .eslintrc.changed.js
|
I have some issues with ios build, so I'll attach the recording tomorrow. |
|
@paultsimura 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] |
paultsimura
left a comment
There was a problem hiding this comment.
Overall – solid work 🔥
I'm sure we could break something but it's nearly impossible to test everything on such a change. Too bad we don't have robust unit tests yet 😞
|
|
||
| const moneyRequestReportID = originalMessage?.IOUReportID ?? -1; | ||
| const moneyRequestReportID = originalMessage?.IOUReportID; | ||
|
|
||
| if (!moneyRequestReportID) { |
There was a problem hiding this comment.
I think it's better to keep it.
| originalMessage: { | ||
| ...(originalMessage ?? {}), | ||
| whisperedTo: hasReceipt ? originalMessage?.whisperedTo : [], | ||
| linkedReportID: originalMessage?.linkedReportID ?? '0', | ||
| }, | ||
| originalMessage: originalMessage | ||
| ? { | ||
| ...originalMessage, | ||
| whisperedTo: hasReceipt ? originalMessage.whisperedTo : [], | ||
| linkedReportID: originalMessage.linkedReportID, | ||
| } | ||
| : undefined, |
There was a problem hiding this comment.
I'm not sure about this change 🤔
We used to always assign an object, and now it's undefined. Are you confident it's safe? Maybe let's at least fall back to {}?
There was a problem hiding this comment.
Defaulting to {} causes TS errors.
I'm not sure if there was no originalMessage before, update function should create one...
There was a problem hiding this comment.
One suggestion: there are multiple places where we do things like:
iouReportID ? reportsTransactions[iouReportID] ?? [] : []WDYT about making a private function and reuse it?
function reportsTransactionsOrEmpty(reportID: string | undefined) {
if (!reportID) {
return [];
}
return reportsTransactions[reportID] ?? [];
}|
@paultsimura I've applied your feedback. I'm going to be OOO 25-29 Dec 🎄 , maybe it would be good not to merge this PR during the time, so I can be around to monitor any regressions. |
Got it, I'll hold on with approval. There seem to be conflicts anyway now. |
…efault-id # Conflicts: # src/libs/ReportActionsUtils.ts # src/libs/ReportUtils.ts
|
@paultsimura Conflicts are resolved! |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid.webmAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2024-12-30.at.19.25.22.movMacOS: Desktop |
|
@VickyStash should we remove |
| // eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style | ||
| iouReportID={ReportActionsUtils.getIOUReportIDFromReportActionPreview(action) as string} |
There was a problem hiding this comment.
Instead can we have the component set iouReportID as an optional string?
There was a problem hiding this comment.
Yes, and it should be done during PureReportActionItem updates. I didn't include it in this PR cause it's already complex enough and touches different functionality.
Updating PureReportActionItem + ReportPreview will require dealing with at least 40 more lint/ts cases, which should be then tested. So I think it would be safe to handle it separately.
neil-marcellini
left a comment
There was a problem hiding this comment.
Good to go, thank you
|
✋ 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/neil-marcellini in version: 9.0.81-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.0.81-6 🚀
|
Explanation of Change
Fixed Issues
$ #50360
PROPOSAL: #50360 (comment)
Tests
Test report-related functionality:
Offline tests
Same, as in the Tests section.
QA Steps
Same, as in the Tests section.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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
android1.mp4
Android: mWeb Chrome
android_web1.mp4
iOS: Native
iOS: mWeb Safari
ios_web1.mp4
MacOS: Chrome / Safari
web1.mp4
MacOS: Desktop
desktop1.mp4