Prevent making redundant API call when report is not loaded#74925
Prevent making redundant API call when report is not loaded#74925justinpersaud merged 3 commits intomainfrom
Conversation
|
@shubham1206agra 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!
|
|
@shubham1206agra would be able to review it today? |
Reviewer Checklist
Screenshots/VideosScreen.Recording.2025-11-18.at.7.05.14.PM.mov |
|
@justinpersaud 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] |
|
🎯 @shubham1206agra, thanks for reviewing and testing this PR! 🎉 An E/App issue has been created to issue payment here: #75401. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
|
🚀 Deployed to staging by https://github.com/justinpersaud in version: 9.2.61-0 🚀
|
|
@MonilBhavsar Is it enough to check Web only? QA team can't check api calls in mWeb and Native apps |
|
For Part 1, we can only check web. I think we test Part 2 on all platforms |
|
🚀 Deployed to production by https://github.com/grgia in version: 9.2.61-5 🚀
|
…l sites The previous fix (PR #74925) only added the hasOnceLoadedReportActions check to one location in ReportActionsList.tsx. This left 7+ other code paths that could call readNewestAction before the report was shared, causing 401 Unauthorized errors from UpdateRNVPLastReadTime. This commit adds the same guard pattern to all remaining call sites: - ReportActionsList.tsx: handleAppVisibilityMarkAsRead, scrollToBottomAndMarkReportAsRead - MoneyRequestReportActionsList.tsx: all 3 effects/callbacks that call readNewestAction - useReportUnreadMessageScrollTracking.ts: onViewableItemsChanged callback - ReportScreen.tsx: task report useEffect The fix ensures the hooks re-run when hasOnceLoadedReportActions changes from false to true, so reports are correctly marked as read once loaded. Co-authored-by: Monil Bhavsar <MonilBhavsar@users.noreply.github.com>
Explanation of Change
Let's not mark report as read when the report has not been loaded/shared with user.
The API call fails since the report(transaction thread) is not shared with the user, spamming the logs.
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/557858
PROPOSAL:
Tests
Part 1
ReadNewestActionand thenOpenReport, instead its vice versaPart 2
Test this suite for Unread messages https://test-management.browserstack.com/projects/2219752/folder/13176723/test-cases/41237056
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
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.2025-11-12.at.5.32.56.PM.mov
Screen.Recording.2025-11-12.at.5.35.44.PM.mov
MacOS: Desktop