Skip to content

Commit a6205c7

Browse files
committed
Stay in Search tab when navigating to parent from chat thread RHP
1 parent e0492e8 commit a6205c7

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/components/ParentNavigationSubtitle.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,14 @@ function ParentNavigationSubtitle({
190190
return;
191191
}
192192
}
193+
194+
// Stay in the Search tab when the parent link is tapped from a SEARCH_REPORT RHP
195+
// and the parent isn't already in the stack — otherwise the REPORT_WITH_ID fallback
196+
// would yank the user to Inbox.
197+
if (isReportInRHP) {
198+
Navigation.navigate(ROUTES.SEARCH_REPORT.getRoute({reportID: parentReportID, reportActionID: isVisibleAction ? parentReportActionID : undefined}));
199+
return;
200+
}
193201
}
194202

195203
// If the parent report is already the previous screen in the main stack, go back to it

src/pages/inbox/HeaderView.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import SidePanelButton from '@components/SidePanel/SidePanelButton';
2121
import TaskHeaderActionButton from '@components/TaskHeaderActionButton';
2222
import Text from '@components/Text';
2323
import Tooltip from '@components/Tooltip';
24-
import {useWideRHPState} from '@components/WideRHPContextProvider';
2524
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
2625
import useHasTeam2025Pricing from '@hooks/useHasTeam2025Pricing';
2726
import useIsInSidePanel from '@hooks/useIsInSidePanel';
@@ -106,8 +105,7 @@ function HeaderView({onNavigationMenuButtonClicked, reportID}: HeaderViewProps)
106105
const {isSmallScreenWidth, shouldUseNarrowLayout, isInLandscapeMode} = useResponsiveLayout();
107106
const isInSidePanel = useIsInSidePanel();
108107
const route = useRoute();
109-
const {wideRHPRouteKeys, superWideRHPRouteKeys} = useWideRHPState();
110-
const openParentReportInCurrentTab = route.name === SCREENS.RIGHT_MODAL.SEARCH_REPORT && (wideRHPRouteKeys.length > 0 || superWideRHPRouteKeys.length > 0);
108+
const openParentReportInCurrentTab = route.name === SCREENS.RIGHT_MODAL.SEARCH_REPORT;
111109
const [parentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(report?.parentReportID) ?? getNonEmptyStringOnyxID(report?.reportID)}`);
112110
const [grandParentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${getNonEmptyStringOnyxID(parentReport?.parentReportID)}`);
113111
const grandParentReportAction = useParentReportAction(parentReport);

0 commit comments

Comments
 (0)