MED Refactor ShowContextMenuContext to pass isReportArchived instead of rNVPs#65179
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] |
| anchor: null, | ||
| report, | ||
| reportNameValuePairs: undefined, | ||
| isReportArchived, |
There was a problem hiding this comment.
Why do we need to add isReportArchived value here? The previous logic is using undefined value
There was a problem hiding this comment.
I've fixed this
| checkIfContextMenuActive: () => {}, | ||
| onShowContextMenu: () => {}, | ||
| reportNameValuePairs: undefined, | ||
| isReportArchived, |
| () => ({ | ||
| anchor: popoverAnchorRef.current, | ||
| report, | ||
| reportNameValuePairs, |
There was a problem hiding this comment.
Let's remove reportNameValuePairs prop totally in this component
|
Also please remove reportNameValuePairs parameter and use isReportArchived param in getLastMessageTextForReport function |
@DylanDylann I've updated this func, please check again |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-06-30.at.21.06.16.movAndroid: mWeb ChromeScreen.Recording.2025-06-30.at.21.05.42.moviOS: HybridAppScreen.Recording.2025-06-30.at.21.04.58.moviOS: mWeb SafariScreen.Recording.2025-06-30.at.21.03.28.movMacOS: Chrome / SafariScreen.Recording.2025-06-30.at.21.00.54.movMacOS: DesktopScreen.Recording.2025-06-30.at.21.02.24.mov |
| onShowContextMenu: (callback) => callback(), | ||
| report: undefined, | ||
| reportNameValuePairs: undefined, | ||
| isReportArchived: undefined, |
There was a problem hiding this comment.
NAB: This could default to false since it's a boolean (and that's what the default parameter does).
| policy?: OnyxEntry<Policy>, | ||
| reportNameValuePairs?: OnyxInputOrEntry<ReportNameValuePairs>, | ||
| ): string { | ||
| function getLastMessageTextForReport(report: OnyxEntry<Report>, lastActorDetails: Partial<PersonalDetails> | null, policy?: OnyxEntry<Policy>, isReportArchived?: boolean): string { |
There was a problem hiding this comment.
| function getLastMessageTextForReport(report: OnyxEntry<Report>, lastActorDetails: Partial<PersonalDetails> | null, policy?: OnyxEntry<Policy>, isReportArchived?: boolean): string { | |
| function getLastMessageTextForReport(report: OnyxEntry<Report>, lastActorDetails: Partial<PersonalDetails> | null, policy?: OnyxEntry<Policy>, isReportArchived = false): string { |
Default this to false to be consistent with the other places we are using a parameter like this.
| const lastActorDetails = lastActorAccountID ? (personalDetails?.[lastActorAccountID] ?? null) : null; | ||
| const lastActorDisplayName = getLastActorDisplayName(lastActorDetails); | ||
| const lastMessageTextFromReport = getLastMessageTextForReport(report, lastActorDetails, undefined, reportNameValuePairs); | ||
| const lastMessageTextFromReport = getLastMessageTextForReport(report, lastActorDetails, undefined, !!reportNameValuePairs?.private_isArchived); |
There was a problem hiding this comment.
You should probably use result.private_isArchived here since it's already defined above. Then, up above where result.private_isArchived is defined, be sure to add !! in front of the NVP reference.
There was a problem hiding this comment.
@tgolen I updated to use !!result.private_isArchived directly in getLastMessageTextForReport since the private_isArchived type is string, we cannot assign it to boolean value
| let lastMessageTextFromReport = lastMessageTextFromReportProp; | ||
| if (!lastMessageTextFromReport) { | ||
| lastMessageTextFromReport = getLastMessageTextForReport(report, lastActorDetails, policy, reportNameValuePairs); | ||
| lastMessageTextFromReport = getLastMessageTextForReport(report, lastActorDetails, policy, !!reportNameValuePairs?.private_isArchived); |
There was a problem hiding this comment.
Same here. Use result.private_isArchived and add !! to the definition above.
| anchor: null, | ||
| report: undefined, | ||
| reportNameValuePairs: undefined, | ||
| isReportArchived: undefined, |
|
@thelullabyy Please resolve conflict |
|
@DylanDylann I've resolved conflicts, pls check again |
|
@tgolen All your |
|
✋ 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/tgolen in version: 9.1.74-2 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.1.74-10 🚀
|
Explanation of Change
Fixed Issues
$ #64933
PROPOSAL: #64933 (comment)
Tests
Offline tests
QA Steps
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))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.mov
Android: mWeb Chrome
android_web.mov
iOS: Native
ios.mov
iOS: mWeb Safari
ios_web.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov