Skip to content

Commit ee19279

Browse files
authored
Merge pull request Expensify#60873 from nyomanjyotisa/issue-60574
Fix: Expense Reports tab isn't highlighted anymore after clicking on an report
2 parents a9b6d36 + def699d commit ee19279

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/pages/Search/SearchMoneyRequestReportPage.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
1919
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
2020
import type {SearchFullscreenNavigatorParamList} from '@libs/Navigation/types';
2121
import {isValidReportIDFromPath} from '@libs/ReportUtils';
22+
import {buildSearchQueryJSON} from '@libs/SearchQueryUtils';
2223
import Navigation from '@navigation/Navigation';
2324
import ReactionListWrapper from '@pages/home/ReactionListWrapper';
2425
import variables from '@styles/variables';
@@ -65,6 +66,13 @@ function SearchMoneyRequestReportPage({route}: SearchMoneyRequestPageProps) {
6566
openReport(reportIDFromRoute, '', [], undefined, undefined, false, [], undefined, true);
6667
}, [reportIDFromRoute]);
6768

69+
const queryJSON = useMemo(() => {
70+
const backTo = route.params.backTo ?? '';
71+
const queryString = backTo.split('?').at(1) ?? '';
72+
const q = new URLSearchParams(queryString).get('q') ?? '';
73+
return buildSearchQueryJSON(q);
74+
}, [route.params.backTo]);
75+
6876
// eslint-disable-next-line rulesdir/no-negated-variables
6977
const shouldShowNotFoundPage = useMemo(
7078
(): boolean => {
@@ -134,7 +142,7 @@ function SearchMoneyRequestReportPage({route}: SearchMoneyRequestPageProps) {
134142
shouldDisplaySearch={false}
135143
shouldShowLoadingBar={false}
136144
/>
137-
<SearchTypeMenu queryJSON={undefined} />
145+
<SearchTypeMenu queryJSON={queryJSON} />
138146
</View>
139147
<NavigationTabBar selectedTab={NAVIGATION_TABS.SEARCH} />
140148
</View>

0 commit comments

Comments
 (0)