perf: calculate chat tab brick road based on derived value#61376
Conversation
| } | ||
| const reportOption = {...report, isUnread: isUnread(report, oneTransactionThreadReport), isUnreadWithMention: isUnreadWithMention(report)}; | ||
| const shouldShowGreenDotIndicator = requiresAttentionFromCurrentUser(reportOption, itemParentReportAction); | ||
| return shouldShowGreenDotIndicator ? CONST.BRICK_ROAD_INDICATOR_STATUS.INFO : undefined; |
There was a problem hiding this comment.
This function seems to share the same logic that is used to determine GBR/RBR status for a report in a derived value, so it is safe to simply check the brick road status directly instead of computing it
|
@rushatgabhane 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] |
|
cc @hoangzinh you might be interested in reviewing this one as well as you are already familiar with this part |
|
@rushatgabhane has been assigned to this issue #60007, so let he handles here, and we can expand knowledge about |
|
@rushatgabhane friendly bump 🙏 |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppWhatsApp.Video.2025-05-09.at.08.25.49.mp4Android: mWeb ChromeiOS: HybridAppScreen.Recording.2025-05-09.at.08.43.48.moviOS: mWeb SafariScreen.Recording.2025-05-09.at.08.45.44.movMacOS: Chrome / SafariScreen.Recording.2025-05-09.at.08.27.50.movScreen.Recording.2025-05-09.at.08.26.16.movMacOS: Desktop |
|
updated with main and removed the console.log I missed before 👀 |
|
could you please delete commit that updated the submodule |
0155fb6 to
70ee8ea
Compare
|
ah my bad, removed, thank you |
mountiny
left a comment
There was a problem hiding this comment.
Going to move it ahead but left some NAB comments
| dataToIterate = prepareReportKeys(updates); | ||
| recentlyUpdated = updates; | ||
| } else if (!!transactionsUpdates || !!transactionViolationsUpdates) { | ||
| let transactionReportIds: string[] = []; |
There was a problem hiding this comment.
| let transactionReportIds: string[] = []; | |
| let transactionReportIDs: string[] = []; |
There was a problem hiding this comment.
I'll update it with one of the following PRs, thanks
| const [currentUserLogin] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email, canBeMissing: true}); | ||
| const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP, {canBeMissing: true}); |
There was a problem hiding this comment.
can these be missing really?
There was a problem hiding this comment.
This property is here for a while now but I still find it super confusing. Out of curiosity I just checked the codebase and this key is used 4 times with false and 11 times with true and I can't really say what's the difference. The JSDoc description of this param is not clear to me and based on these numbers I think it might be problematic for more people. Can we do something to improve it? cc @fabioh8010
|
✋ 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/mountiny in version: 9.1.45-0 🚀
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.1.45-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.1.45-21 🚀
|
Explanation of Change
This PR calculates brick road status in navigation bar based on a derived value instead of calculating everything from scratch each time.
Performance comparison:
Environment: Web, 10x CPU throttle
Action performed: Measured
getChatTabBrickRoadfunction which is being fired each time user is switching between navigation tabs, while in "Most recent" modeFixed Issues
$ #59350
$ #60007
PROPOSAL:
Tests
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 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
iOS: Native
ios.mp4
iOS: mWeb Safari
ios-web.mp4
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov