perf: avoid using getOrderedReportIDs when calculating GBR/RBR state#55260
Conversation
|
@rayane-djouah 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] |
fa2b147 to
20adc9c
Compare
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-01-23.at.3.20.49.PM.movAndroid: mWeb ChromeScreen.Recording.2025-01-23.at.3.22.11.PM.moviOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2025-01-23.at.15.16.43.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2025-01-23.at.15.18.36.mp4MacOS: Chrome / SafariScreen.Recording.2025-01-23.at.3.17.05.PM.movMacOS: DesktopScreen.Recording.2025-01-23.at.3.17.34.PM.mov |
|
Updated with latest main, @rayane-djouah mind taking a look? |
|
hey @rayane-djouah, friendly ping there! |
| const allReports = reportIDs.map((reportID) => reports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]); | ||
|
|
||
| function getChatTabBrickRoadReport(policyID: string | undefined, orderedReportIDs: string[] = []): OnyxEntry<Report> { | ||
| const allReports = orderedReportIDs.map((reportID) => reportsCollection?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]); |
There was a problem hiding this comment.
Not sure if this is necessary, but since we were returning undefined when reportIDs is empty, should we do the same for orderedReportIDs?
| const allReports = orderedReportIDs.map((reportID) => reportsCollection?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]); | |
| if (!orderedReportIDs.length) { | |
| return undefined; | |
| } | |
| const allReports = orderedReportIDs.map((reportID) => reportsCollection?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]); |
There was a problem hiding this comment.
There was a problem hiding this comment.
yeah we can do that for better readability, updated the PR
|
Bug: When there are multiple actions awaiting the user and the user performs one of them, the chat tab breadcrumb briefly hides and reappears. It should remain visible without disappearing momentarily. Screen.Recording.2025-01-23.at.1.05.36.PM.mov |
|
@rayane-djouah looks like a regression from another PR, the same happens on edit: looks like it happens on staging as well, once I have all tasks in concierge chat marked as done and I am checking tasks from another chat |
|
Yeah, it seems reproducible on the |
|
✋ 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/carlosmiceli in version: 9.0.89-0 🚀
|
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.89-8 🚀
|
Explanation of Change
The function doing heavy calculations
getOrderedReportIDsis called multiple times to calculate RBR state in the Bottom tabs menu. This leads to multiple slowdowns in the app when using account with a lot of data in the Onyx state, including switching between chats or switching between bottom tabs.Fixed Issues
$ #55173
$ #54802
PROPOSAL: #54802 (comment)
Tests
Offline tests
n/a
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 stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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.mov
Android: mWeb Chrome
android-web.mov
iOS: Native
ios.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov