Repository navigation
79170: Reports-After moving expense to new report on 'Top Spenders', menu only shows 'Export' option - #82590
Conversation
…menu only shows 'Export' option
|
@mananjadhav 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] |
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.
|
heyjennahay
left a comment
There was a problem hiding this comment.
Bug fix. Product review not required
|
@mananjadhav soft remainder to take a look here. |
|
Yes I've started reviewing this. |
|
@abbasifaizan70 I've been trying to wrap my head around the proposed fix. I think we're over engineering the solution. Can we somehow leverage |
|
@mananjadhav
So we need both: refetch on focus (to update the snapshot) and collapse on return (so the next expand uses that updated snapshot). Relying only on clearSelectedTransactions() would not fix the stale dropdown; collapsing (plus refetch) does. |
|
You might be right about the shortfalls of just using clearSelectedTransactions. But adding a prop like |
…ion counts and dropdown actions in sync after moving expenses.
|
I dropped the collapseExpandedGroupsTrigger prop approach and moved to a more local fix. |
|
@MelvinBot Please review this PR. |
PR ReviewSummary: This PR fixes stale dropdown options (e.g., only "Export" shown) in grouped search views (Top Spenders) after returning from RHP flows like "Move Expense" → "Create Report". It does so by detecting focus-return transitions and refetching expanded group data. All CI checks are passing. What ChangedSingle file modified:
AnalysisThe core logic is sound. The ref-based focus tracking pattern (
Suggestions
VerdictThe approach is clean and correctly addresses the stale snapshot problem without over-engineering (the earlier The suggestion in point 1 above is non-blocking — the current implementation is functionally correct. Up to the reviewer whether the minor optimization is worth the additional function. |
|
@mananjadhav, updated code with Melvin Bot suggestions. Please have a look. Thanks |
|
With the new changes I am a little concerned on the rerenders or the number of API calls. I am just trying to test that for now. |
|
Taking over from here |
|
@aimane-chnaif Will review this PR. |
|
@aimane-chnaif Can u please review this PR? Thanks |
|
Please merge main |
|
@aimane-chnaif updated with main. Thanks |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.mov |
| const wasScreenFocusedRef = useRef(isScreenFocused); | ||
| useEffect(() => { | ||
| const didReturnToScreen = wasScreenFocusedRef.current === false && isScreenFocused === true; | ||
| wasScreenFocusedRef.current = isScreenFocused; | ||
|
|
||
| if (!didReturnToScreen || !isExpanded || isExpenseReportType) { | ||
| return; | ||
| } | ||
|
|
||
| // Keep expanded group rows in sync with updated grouped totals after returning from RHP flows. | ||
| refreshTransactions(); |
There was a problem hiding this comment.
@MelvinBot is this pattern (refresh data on screen focus) used elsewhere in the app?
|
@abbasifaizan70 in the future PRs, can you please stop copy & pasting Tests steps from the linked issue? At least, read what you wrote.
11, 14 are bugs we're fixing here. |
|
Yes, this pattern is used extensively throughout the app — 147+ files use screen focus to trigger data refreshes. The three main variants are:
Notable examples closest to this PR's pattern (detecting screen return specifically):
|
|
@aimane-chnaif removed useCallback from the above-mentioned files. |
|
🚧 @puneetlath has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/puneetlath in version: 9.3.58-0 🚀
Bundle Size Analysis (Sentry): |
|
No help site changes required. This PR fixes a bug where expanded group rows in grouped search results (e.g., Top Spenders) would collapse after navigating away and returning (e.g., after "Move Expense → Create Report"). The changes are entirely internal to
There are no new features, renamed UI elements, new settings, or changes to user-facing workflows. The existing help site content under |
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.3.58-9 🚀
|
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.3.58-9 🚀
|
Explanation of Change
When you leave a grouped search (e.g. Top Spenders) and come back (e.g. after closing the expense view or finishing “Move Expense” → “Create Report”), the app refetches the search from the API and collapses any expanded group rows.
Fixed Issues
$ #79170
PROPOSAL:
Tests
Prerequisite: The account must have at least one workspace.
Offline tests
This is only for online.
QA Steps
same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand 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.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2026-02-17.at.12.06.41.AM.mov
Android: mWeb Chrome
Screen.Recording.2026-02-17.at.12.08.50.AM.mov
iOS: Native
Screen.Recording.2026-02-17.at.12.02.31.AM.mov
iOS: mWeb Safari
Screen.Recording.2026-02-16.at.11.47.38.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-03-05.at.1.51.38.AM.mov