-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: expense report disappears from LHN after opening transaction thread header in RHP #61130
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
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. |
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.
LGTM
@WojtekBoman @adamgrzybowski could you please review this one? |
src/libs/ReportUtils.ts
Outdated
@@ -7999,19 +8002,18 @@ function parseReportRouteParams(route: string): ReportRouteParams { | |||
return {reportID: '', isSubReportPageRoute: false}; | |||
} | |||
|
|||
const pathSegments = parsingRoute.split('/'); | |||
const state = getStateFromPath(parsingRoute, linkingConfig.config) as PartialState<NavigationState<RootNavigatorParamList>>; |
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 you can use here @libs/Navigation/helpers/getStateFromPath
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.
@nkdengineer thoughts?
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.
@WojtekBoman I updated.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
src/libs/ReportUtils.ts
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if maybe we could just return a focusedRoute if it is a report route?
reportID
is not the only param of the report screen which could be missleadingisSubReportPageRoute
for 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamgrzybowski Currently, this function is only focusing on the r/
route.
Lines 8040 to 8045 in 0601503
if (!parsingRoute.startsWith(addTrailingForwardSlash(ROUTES.REPORT))) { | |
return {reportID: '', isSubReportPageRoute: false}; | |
} | |
const pathSegments = parsingRoute.split('/'); | |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
@adamgrzybowski I added.
@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 |
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.
LGTM 🚀
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. |
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectioncanBeMissing
param foruseOnyx
toggleReport
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
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