Always use immediate parent report when rendering navigation header#37436
Conversation
…arents, but rather always use the immediate parent
|
@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] |
|
PR still missing Android native video (still building the app, it takes a very long time for me, I'll add it once build finishes). One comment, I opted to rename the |
|
Android video uploaded |
|
Thanks @barros001, I'm reviewing it now. In the meantime, could you please add another set of test steps to the PR description? Test 1
Test 2
|
|
@paultsimura good point, I added the test scenario (and also performed it myself to verify it works, and it does). |
|
Hey @barros001, here's a bold suggestion, but after digging deeper into the code and testing, I think we can just go with this (we may add one more check to address a bug I'll post in a separate comment): function getParentNavigationSubtitle(report: OnyxEntry<Report>): ParentNavigationSummaryParams {
const parentReport = getParentReport(report);
if (isEmptyObject(parentReport)) {
return {};
}
return {
reportName: getReportName(parentReport),
workspaceName: getPolicyName(parentReport, true),
};
}Could you please test if you could find any broken behavior if we go this way? |
It appears that this happens every time you go one step deep from a Workspace. Go to any workspace, send a message and then click reply in thread. You will see "From Workspace in Workspace". Looks like we need an extra check if the parent report is a workspace, if that's the case then we do not return the workspace name. That sounds simple, I'll check it out. As far as your bold suggestion, I'm still looking but that makes me a little nervous because I'm not sure how to test all scenarios. For example, how do I navigate to a report where |
That's a valuable addition, thanks. I've tested different scenarios – this bug seems complicated enough to deserve a separate issue IMO. So we'll proceed only with the current scope. |
Agreed! As I had already spent some time digging, here's what I found, for future reference:
With that, here's what I tried: Added the following function: function isWorkspace(report: OnyxEntry<Report>): boolean {
return !isThread(report) && isPolicyExpenseChat(report) && !!report?.isOwnPolicyExpenseChat;
}Then updated the logic to check if it's a workspace, as follows: if (isWorkspace(parentReport) || isIOURequest(parentReport)) {
return {
reportName: getReportName(parentReport),
};
}I tested the scenarios I could think of and it seems to work, including the one when an admin is viewing an expense report sent by another user (here's why With all this said, this all looks very complicated and error prone. There's no simple way to tell things apart and there's way too much logic all over the codebase that it's hard to make assumptions (hence my hesitation of making the method short as you suggested). I'm always down to simplify things, make code better, but in this current situation I'm leaning towards staying on the pragmatism camp. |
I understand your concerns, but from my tests, there is no error in the suggested simplified approach. |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid-compressed.mp4Android: mWeb Chromechrome-compressed.mp4iOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-02-28.at.21.53.27-compressed.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-02-28.at.21.51.47-compressed.mp4MacOS: Chrome / SafariScreen.Recording.2024-02-28.at.20.42.43-compressed.mp4MacOS: DesktopScreen.Recording.2024-02-28.at.21.36.59-compressed.mp4 |
|
@paultsimura I just pushed a simplified version. I still have the But I do trust you when you say you tested and didn't find any errors, you have a whole lot more experience with the codebase than I do. I'll push an update shortly. |
|
No, hold on please. I'll test a few more cases that look suspicious 🤔 |
|
@paultsimura alright, I found where Here are the steps:
That's when that block is true. Here's a screenshot without that
Notice the header where it says Here's a screenshot of how it currently is:
So that Thoughts? |
|
About the thing with the An IOU request is a 1:1 money request (not a request from a workspace). Therefore, there should not be a policy related to the parent report (except for the personal expense policy, which is currently shown in the subtitle in production). I did notice the same thing you've mentioned here, therefore I asked to hold on. But if you check production – this check has no effect, and the If we leave this check, we'll basically introduce a new inconsistent behavior (e.g. if you create a thread inside that thread, the So I would say we should remove this check as well (so the workspace name is consistent with the production) and if we consider it as a but – we should address it separately along with the |
Came here to say pretty much the same. I just noticed that having the I'll go ahead and push a new version. |
…eader when it was not supposed to.
|
Done, new version pushed. Phew! That was a tricky one. I appreciate the thorough review and feedback. |
paultsimura
left a comment
There was a problem hiding this comment.
LGTM!
@barros001 thanks for keeping the discussion here fruitful 💪
|
✋ 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/cristipaval in version: 1.4.45-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.45-6 🚀
|






Details
Fixed Issues
$ #37111
PROPOSAL: #37111 (comment)
Tests
Test 1
Test 2
Offline tests
Test 1
Test 2
QA Steps
Test 1
Test 2
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.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 so 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.webm
Android: mWeb Chrome
android.web.webm
iOS: Native
ios.mp4
iOS: mWeb Safari
ios.web.mp4
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov