Fix the getPolicyName function for when the report or policies are not ready#48621
Conversation
|
@allgandalf 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] |
src/libs/ReportUtils.ts
Outdated
|
|
||
| if ((!allPolicies || Object.keys(allPolicies).length === 0) && !report?.policyName) { | ||
| if (isEmptyObject(allPolicies) && !report?.policyName) { |
There was a problem hiding this comment.
@allgandalf upon further consideration, I believe the second check is unreachable. My suggestion would be to eliminate it. Your thoughts?
There was a problem hiding this comment.
Yeah i too checked, it is unreachable , lets remove this
|
@allgandalf sorry, need to convert back to draft, I'll need to test more with jest |
|
@allgandalf My main solution failed the tests due to the possibility of using getPolicyName without any policies, but my other solution (Alternative 3) passed all the tests. Is it ok to move with my alternative 3 solution? I haven't jest tested my alternative 1, but seems that will pass all the jest tests as well. Failed tests1. opens a chat and load newer messagesApp/tests/ui/PaginationTest.tsx Line 312 in 8a35256
App/tests/unit/ReportUtilsTest.ts Line 208 in 8a35256
App/tests/unit/ReportUtilsTest.ts Line 246 in 8a35256
Line 93 in 8a35256 |
src/libs/ReportUtils.ts
Outdated
|
|
||
| if ((!allPolicies || Object.keys(allPolicies).length === 0) && !report?.policyName) { | ||
| if (isEmptyObject(allPolicies) && !report?.policyName) { | ||
| return unavailableTranslation; | ||
| } |
There was a problem hiding this comment.
@wildan-m This whole expression is unreachable.
There was a problem hiding this comment.
Yeah, I'm aware of that. This is my latest suggestion.
@allgandalf what is your opinion?
…x/44480-fix-undesired-unavailable-workspace
Yes please, lets get this over the line |
|
@allgandalf The PR has been updated |
|
@wildan-m can you update your videos with the latest solution please |
…x/44480-fix-undesired-unavailable-workspace
|
@allgandalf sure, the videos has been updated |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-09-11.at.3.30.29.PM.movAndroid: mWeb ChromeScreen.Recording.2024-09-11.at.3.29.09.PM.moviOS: NativeScreen.Recording.2024-09-11.at.3.33.04.PM.moviOS: mWeb SafariScreen.Recording.2024-09-11.at.3.33.38.PM.movMacOS: Chrome / SafariScreen.Recording.2024-09-11.at.3.28.17.PM.movMacOS: DesktopScreen.Recording.2024-09-11.at.3.31.06.PM.mov |
|
✋ 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 production by https://github.com/luacmartins in version: 9.0.33-4 🚀
|
Details
Fix concierge chat header on initial login
Fixed Issues
$ #44480
PROPOSAL: #44480 (comment)
Tests
Offline tests
Should always online
QA Steps
Same as test
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.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
Kapture.2024-09-10.at.15.48.26.mp4
Android: mWeb Chrome
Kapture.2024-09-10.at.15.50.48.mp4
iOS: Native
Kapture.2024-09-10.at.15.45.49.mp4
iOS: mWeb Safari
Kapture.2024-09-10.at.15.49.24.mp4
MacOS: Chrome / Safari
Kapture.2024-09-10.at.15.42.18.mp4
MacOS: Desktop
Kapture.2024-09-10.at.15.56.43.mp4