Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ function MoneyRequestReportNavigation({reportID, shouldDisplayNarrowVersion}: Mo
shouldCalculateTotals: false,
searchKey: lastSearchQuery.searchKey,
isLoading: isSearchLoading,
shouldUpdateLastSearchParams: true,
});
}

Expand Down
14 changes: 14 additions & 0 deletions src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import useSearchHighlightAndScroll from '@hooks/useSearchHighlightAndScroll';
import useSearchShouldCalculateTotals from '@hooks/useSearchShouldCalculateTotals';
import useThemeStyles from '@hooks/useThemeStyles';
import {turnOffMobileSelectionMode, turnOnMobileSelectionMode} from '@libs/actions/MobileSelectionMode';
import {saveLastSearchParams} from '@libs/actions/ReportNavigation';
import type {TransactionPreviewData} from '@libs/actions/Search';
import {setOptimisticDataForTransactionThreadPreview} from '@libs/actions/Search';
import {flushDeferredWrite, getOptimisticWatchKey, hasDeferredWrite} from '@libs/deferredLayoutWrite';
Expand Down Expand Up @@ -1136,6 +1137,16 @@ function Search({
unmarkReportIDAsMultiTransactionExpense(reportID);
}

// Persist the current search context so prev/next navigation arrows
// in the report RHP can reference the correct result set.
saveLastSearchParams({
queryJSON,
offset,
searchKey: currentSearchKey,
hasMoreResults: !!searchResults?.search?.hasMoreResults,
allowPostSearchRecount: true,
});

requestAnimationFrame(() => Navigation.navigate(ROUTES.SEARCH_MONEY_REQUEST_REPORT.getRoute({reportID, backTo})));
return;
}
Expand Down Expand Up @@ -1176,6 +1187,9 @@ function Search({
betas,
email,
accountID,
queryJSON,
offset,
searchResults?.search?.hasMoreResults,
],
);

Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ function search({
prevReportsLength,
isOffline = false,
isLoading,
shouldUpdateLastSearchParams = true,
shouldUpdateLastSearchParams = false,
skipWaitForWrites = false,
}: {
queryJSON: SearchQueryJSON;
Expand Down
Loading