Skip to content
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

Fix LHN breaking when leaving deep linked room #40701

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2466,11 +2466,13 @@ function navigateToMostRecentReport(currentReport: OnyxEntry<Report>) {
const lastAccessedReportID = filteredReportsByLastRead.at(-1)?.reportID;
const isChatThread = ReportUtils.isChatThread(currentReport);
if (lastAccessedReportID) {
const lastAccessedReportRoute = ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID ?? '');
// If it is not a chat thread we should call Navigation.goBack to pop the current route first before navigating to last accessed report.
if (!isChatThread) {
Navigation.goBack();
// Fallback to the lastAccessedReportID route, if this is first route in the navigator
Navigation.goBack(lastAccessedReportRoute);
}
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID ?? ''), CONST.NAVIGATION.TYPE.FORCED_UP);
Navigation.navigate(lastAccessedReportRoute, CONST.NAVIGATION.TYPE.FORCED_UP);
} else {
const participantAccountIDs = PersonalDetailsUtils.getAccountIDsByLogins([CONST.EMAIL.CONCIERGE]);
const chat = ReportUtils.getChatByParticipants(participantAccountIDs);
Expand Down