Fix Spend > Needs Approval carousel disappearing after approving a report#89294
Fix Spend > Needs Approval carousel disappearing after approving a report#89294chiragsalian merged 4 commits intomainfrom
Conversation
The && chain's falsy short-circuit handles undefined the same way the original shouldMount expression did, so the explicit cast is noise.
Direct flag name, and the early-return check collapses to a single boolean since once shouldKeepMounted is true it stays true.
|
@abzokhattab 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✅ Changes either increased or maintained existing code coverage, great job!
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppam.mp4Android: mWeb Chromeam.mp4iOS: HybridAppios.moviOS: mWeb Safariios-mweb.movMacOS: Chrome / SafariScreen.Recording.2026-05-01.at.01.38.22.movScreen.Recording.2026-05-01.at.01.43.02.mov |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00c81b19f8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
useSearchSections rebuilds allReports via filter/map each render, so identity comparison would refire setLastValidReports every render and trip 'Maximum update depth exceeded'. The shallow content check converges as soon as the contents stop changing, regardless of reference identity.
|
@madmax330 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] |
Fix Spend > Needs Approval carousel disappearing after approving a report (cherry picked from commit 3a8e67f) (cherry-picked to staging by chiragsalian)
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @chiragsalian has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Cherry-picked to staging by https://github.com/chiragsalian in version: 9.3.64-28 🚀
Bundle Size Analysis (Sentry): |
|
I reviewed the changes in this PR. This is a bug fix for the report carousel in Spend > Needs Approval — it prevents the navigation arrows from disappearing after approving a report. The changes are entirely within No help site changes are required. No user-facing features, settings, labels, or workflows were added, removed, or renamed. The approval flow itself is unchanged — only the carousel's stability during navigation is improved. The help docs don't document carousel behavior at this level of detail. |
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.3.64-31 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/chiragsalian in version: 9.3.65-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.3.65-6 🚀
|
Explanation of Change
When the manager approves a report from
Spend > Needs Approval, the report is removed from the search snapshot (since it no longer matches the "needs approval" filter). The report carousel inside the report screen reads from that snapshot, so the arrows +X of Yindicator disappear immediately after approval, even though there are still other reports left to approve.This PR makes the carousel resilient to its current report leaving the snapshot:
MoneyRequestReportNavigationInnernow caches the last list of reports where the current report was still present (lastValidReports). When the live list drops the current report (e.g. right after approval),effectiveAllReportsfalls back to the cached list socurrentIndex,shouldDisplayNavigationArrows, the prev/next handlers, and the recount effect keep working.MoneyRequestReportNavigation(outer shell) now keeps the inner mounted once the snapshot guard introduced in Avoid mounting MoneyRequestReportNavigation when unnecessary #88714 has passed at least once during this mount (hasGuardEverPassed). Without this, the outer would unmount the inner the moment the snapshot guard flipped false after approval, throwing away the cached list inside.Both pieces use the React-recommended
setState during renderpattern (idempotent updates, no infinite re-render risk). The original perf intent of #88714 — not mounting the heavy inner subscriptions outside of an expense-report search — is preserved on the first render of every mount.Fixed Issues
$ #89255
PROPOSAL:
Tests
I tested this locally by doing the following and confirm the issue was not reproducible.
Perform the steps reported in this issue
#89255
and this issue
#88972
and confirm the issues reported are non reproducible.
Offline tests
N/A
QA Steps
Same as tests.
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.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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari