-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix SearchMoneyRequestReport page calls openReport at least once #80613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SearchMoneyRequestReport page calls openReport at least once #80613
Conversation
|
@ZhenjaHorbach 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] |
|
@ZhenjaHorbach @inimaga One of you needs to 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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 049ab73f53
ℹ️ 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".
| useEffect(() => { | ||
| // Guard prevents calling openReport for multi-transaction reports | ||
| if (visibleTransactions.length > 2) { | ||
| if (visibleTransactions.length > 2 && !isInitialMountRef.current) { | ||
| return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reset initial-mount guard when report changes
Because isInitialMountRef is never reset when navigating to a new report, any subsequent visit to a report with visibleTransactions.length > 2 in the same mounted screen will hit the guard and skip openReport, leaving the report uninitialized. This only shows up when the screen stays mounted across route changes (common in React Navigation). Consider resetting the ref when reportIDFromRoute changes (or keying the guard to the report ID) so each report gets one initial openReport call.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a valid concern that needs to be accounted for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I'll take care of it now.
Reviewer Checklist
Screenshots/VideosAndroid: HybridApp2026-01-28.16.19.29.movAndroid: mWeb Chrome2026-01-28.16.11.58.moviOS: HybridApp2026-01-28.16.19.29.moviOS: mWeb Safari2026-01-28.16.11.58.movMacOS: Chrome / Safari2026-01-28.16.04.27.mov |
inimaga
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Codex highlighted issue needs to be resolved
trjExpensify
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dang, nice catch!
|
@inimaga Fixed switching between multi-transaction reports. It should be working as expected now Screen.Recording.2026-01-28.at.12.05.29.mov |
|
@collectioneur |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
LGTM! |
inimaga
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for handling.
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/inimaga in version: 9.3.11-0 🚀
|
Explanation of Change
Context In PR #80107, a guard was added to useEffect to prevent redundant openReport calls when loading reports with a single expense. However, this guard inadvertently blocked openReport for reports with more than two transactions.
It turns out openReport is still required at least once, even for multi-transaction reports. I have updated the logic to use a ref variable, ensuring openReport is triggered at least once upon component mount. This ensures all reports now load correctly regardless of the transaction count.
Fixed Issues
$ #80572
Tests
Offline tests
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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-01-27.at.12.25.51.mov