fix: expense report disappears from LHN after opening transaction thread header in RHP#61130
Conversation
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-04-30.at.10.23.54.PM.movAndroid: mWeb ChromeScreen.Recording.2025-04-30.at.10.22.05.PM.moviOS: HybridAppScreen.Recording.2025-04-30.at.10.25.30.PM.moviOS: mWeb SafariScreen.Recording.2025-04-30.at.10.22.35.PM.movMacOS: Chrome / SafariScreen.Recording.2025-04-30.at.10.21.01.PM.movMacOS: DesktopScreen.Recording.2025-04-30.at.10.26.11.PM.mov |
I'd like to skip this item of the checklist in this PR because there's an ongoing task #60531 to handle all exiting alerts. |
|
@WojtekBoman @adamgrzybowski could you please review this one? |
| } | ||
|
|
||
| const pathSegments = parsingRoute.split('/'); | ||
| const state = getStateFromPath(parsingRoute, linkingConfig.config) as PartialState<NavigationState<RootNavigatorParamList>>; |
There was a problem hiding this comment.
I think you can use here @libs/Navigation/helpers/getStateFromPath
| const focusedRoute = findFocusedRoute(state); | ||
|
|
||
| const reportIDSegment = pathSegments.at(1); | ||
| const hasRouteReportActionID = !Number.isNaN(Number(reportIDSegment)); | ||
| const reportID = focusedRoute?.params && 'reportID' in focusedRoute.params ? (focusedRoute?.params?.reportID as string) : ''; | ||
|
|
There was a problem hiding this comment.
I think we want to explicitly check if focused route is the right one by checking the name like if (focusedRoute.name === SCREENS.REPORT || ... (check other screens that are report screens))
There may be non report routes that have reportID in the future.
Also, maybe just return undefined if it's not a report route? Why put and empty string and isSubReportPageRoute that doens't really have a meaning in this context?
| if (!reportID) { | ||
| return {reportID: '', isSubReportPageRoute: false}; | ||
| } | ||
|
|
||
| return { | ||
| reportID: reportIDSegment, | ||
| isSubReportPageRoute: pathSegments.length > 2 && !hasRouteReportActionID, | ||
| reportID, | ||
| isSubReportPageRoute: focusedRoute?.name !== SCREENS.REPORT, | ||
| }; |
There was a problem hiding this comment.
I am wondering if maybe we could just return a focusedRoute if it is a report route?
reportIDis not the only param of the report screen which could be missleadingisSubReportPageRoutefor binary situation. What if we get more types of report screens? IMO it's more readable if we just check the name of the route in place where we want to use parseReportRouteParams.
As an afterthought, maybe we could change this function to just parseRoute?
Then check the name in place where this function is used. It looks like it is used only in two places.
On of these places is getReportIDFromLink. It look a little redundant to me.
There was a problem hiding this comment.
@adamgrzybowski Currently, this function is only focusing on the r/ route.
Lines 8040 to 8045 in 0601503
There was a problem hiding this comment.
If it's only for the SCREENS.REPORT, how is this line supposed to work?
isSubReportPageRoute: focusedRoute?.name !== SCREENS.REPORT,
It will always be false
There was a problem hiding this comment.
@adamgrzybowski Here, we're checking with startsWith condition. We can have the route like this r/:reportID/details, ... which isSubReportPageRoute will be true.
There was a problem hiding this comment.
Ok makes sense. Could you please add comment explaining what sub report route is? I don't think this term is widely used in the app.
|
@adamgrzybowski Could you do a final review? @eh2077 can you please re-test? |
|
Yes, sure on it |
Screenshots/VideosAndroid: HybridAppScreen.Recording.2025-05-12.at.11.52.08.PM.movAndroid: mWeb ChromeScreen.Recording.2025-05-12.at.11.49.42.PM.moviOS: HybridAppScreen.Recording.2025-05-12.at.11.50.14.PM.moviOS: mWeb SafariScreen.Recording.2025-05-12.at.11.48.27.PM.movMacOS: Chrome / SafariScreen.Recording.2025-05-12.at.11.42.38.PM.movMacOS: DesktopScreen.Recording.2025-05-12.at.11.45.08.PM.movRetested all platforms and works well! cc @mountiny |
|
Conflicts now |
|
@nkdengineer Please help fix the conflicts, thank you |
|
@mountiny Updated. |
|
✋ 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/mountiny in version: 9.1.46-12 🚀
|
Explanation of Change
fix: expense report disappears from LHN after opening transaction thread header in RHP
Fixed Issues
$ #60749
PROPOSAL: #60749 (comment)
Tests
Offline tests
Same
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
Screen.Recording.2025-04-30.at.09.18.43.mov
Android: mWeb Chrome
Screen.Recording.2025-04-30.at.09.15.00.mov
iOS: Native
Screen.Recording.2025-04-30.at.09.19.50.mov
iOS: mWeb Safari
Screen.Recording.2025-04-30.at.09.17.20.mov
MacOS: Chrome / Safari
Screen.Recording.2025-04-30.at.09.12.41.mov
MacOS: Desktop
Screen.Recording.2025-04-30.at.09.22.10.mov