Fix navigation arrows disappearing during report browsing#88118
Fix navigation arrows disappearing during report browsing#88118leshniak wants to merge 3 commits intoExpensify:mainfrom
Conversation
Background search calls (useSearchHighlightAndScroll, useSearchPageSetup) overwrote REPORT_NAVIGATION_LAST_SEARCH_QUERY with a different search type, causing prev/next arrows to hide. Flip shouldUpdateLastSearchParams default to false in search() so background calls no longer overwrite the navigation context. Persist params explicitly when user selects an expense report row (onSelectRow) and when arrows prefetch more results (goToNextReport). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@aimane-chnaif Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product 👍
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.mov |
|
Please fix conflict |
| @@ -523,7 +516,7 @@ function search({ | |||
| prevReportsLength, | |||
| isOffline = false, | |||
| isLoading, | |||
| shouldUpdateLastSearchParams = true, | |||
| shouldUpdateLastSearchParams = false, | |||
There was a problem hiding this comment.
This affects too many places where this function is called. Please confirm this change doesn't cause any regressions in all affected files.
Payment actions are fine but what about the calls in
- TransactionGroupListItem
- useSearchHighlightAndScroll
- useSearchPageSetup
- SearchPage, SearchPageNarrow
- useSpendOverTimeData?
There was a problem hiding this comment.
Let me ensure.
This is the main fix - in my opinion this default was wrong by design, the "search" action should not implicitly change the state.
There was a problem hiding this comment.
Confirmed — the default flip is safe for all affected callers. Here is the breakdown:
| Caller | Regression risk | Reasoning |
|---|---|---|
| TransactionGroupListItem | None | Refreshes/re-fetches within existing search context. Prev/next state already set at navigation time. |
| useSearchHighlightAndScroll | None | Re-triggers search on new transactions for highlight refresh — not a navigation context change. |
| useSearchPageSetup | None | Initial page search setup. Navigation context is now saved explicitly in Search/index.tsx when user clicks a result, not when search fires. |
| SearchPage / SearchPageNarrow | None | Same as above — handleSearchAction triggers data fetch, but prev/next context is persisted at navigation time. |
| useSpendOverTimeData | None | Already passes false explicitly. No change in behavior. |
The core reasoning: lastSearchParams only matters for prev/next navigation arrows in the report RHP. Those arrows activate when user navigates from search results to a report. This PR moves saveLastSearchParams() to that exact navigation point (Search/index.tsx, the openMoneyRequestReport handler), which is more correct — it captures the state at click time, including hasMoreResults from the already-resolved response, rather than saving it speculatively when the search request fires.
The search() function becomes a pure data-fetch with no implicit navigation state mutation. The one caller that still needs the old behavior (MoneyRequestReportNavigation — pagination for next/prev) now passes shouldUpdateLastSearchParams: true explicitly.
|
The approach is sound — flipping the default to One question on scope:
Everything else looks correct:
Next Steps: Reply with |
|
And there's conflict |
…verwrite # Conflicts: # src/components/Search/index.tsx
|
@aimane-chnaif resolved |
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
Julesssss
left a comment
There was a problem hiding this comment.
New conflicts unfortunately
…verwrite # Conflicts: # src/components/Search/index.tsx
|
resolved again |
|
@aimane-chnaif do you still have concerns? can I convince you more? |
|
Thanks. No more concerns |
|
|
||
| if (isTransactionGroupListItemType(item)) { | ||
| const firstTransaction = item.transactions.at(0); | ||
|
|
There was a problem hiding this comment.
Remove line break as unrelated
|
Approach is correct. Flipping the default to All CI checks pass. The three new One note (reiterated from my earlier comment): |
Regression AnalysisTwo potential regressions found — one likely real, one low-risk. 1.
|
|
Please check potential regressions above |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Explanation of Change
Flip
shouldUpdateLastSearchParamsdefault tofalsein thesearch()action so background searches no longer overwrite the global last-search-params key. Only 2 out of ~10 callers actually need to persist search params — all others are background refreshes, chart data, or bulk action follow-ups.Persist params explicitly at the two points that establish or extend the navigation context:
Search/index.tsxonSelectRow: save params when the user clicks an expense report row to open the RHPMoneyRequestReportNavigation.tsxgoToNextReport: passshouldUpdateLastSearchParams: truewhen prefetching more results via arrows (75% threshold)Fixed Issues
$ #87784
PROPOSAL:
Tests
Offline tests
QA Steps
Same as Tests above.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
bez.nazwy.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
test.mp4