-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Align default IDs in ReportUtils file #54297
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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] |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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] ?? [];
}
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.
Applied: 964115d
@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 |
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.
Tested as thoroughly as I could. Hopefully, we won't break anything as the diff is large 😟
LGTM ✔️
@VickyStash should we remove |
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.
Thanks for this. Mostly looks good. I left some NAB suggestions and I also have a few questions I would like answered before we merge it.
// eslint-disable-next-line @typescript-eslint/non-nullable-type-assertion-style | ||
iouReportID={ReportActionsUtils.getIOUReportIDFromReportActionPreview(action) as string} |
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.
Instead can we have the component set iouReportID as an optional string?
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.
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.
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.
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 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
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