Repository navigation
refactor: Navigation TabBar Indicator status hooks and tests - #79987
carlosmiceli merged 7 commits into
Conversation
|
@Krishna2323 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] |
|
|
||
| // If a policy was just deleted from Onyx, then Onyx will pass a null value to the props, and | ||
| // those should be cleaned out before doing any error checking | ||
| const cleanPolicies = Object.values(policies ?? {}).filter((policy) => policy?.id); |
There was a problem hiding this comment.
❌ PERF-6 (docs)
The cleanPolicies computation should be memoized with useMemo to avoid unnecessary recalculations on every render. The original code in both useIndicatorStatus.ts and useWorkspacesTabIndicatorStatus.ts properly used useMemo for this value, but the refactored code removed the memoization, causing a performance regression.
This creates a new filtered array on every render even when policies hasnt changed, potentially triggering unnecessary re-renders of components consuming this hook.
Suggested fix:
const cleanPolicies = useMemo(() => Object.values(policies ?? {}).filter((policy) => policy?.id), [policies]);There was a problem hiding this comment.
This file is being compiled by React Compiler, therefore this suggestion is invalid.
cc @kacper-mikolajczak could there something be off with the AI-reviewer rule?
|
@carlosmiceli @joekaufmanexpensify this PR is ready for review. Not sure if we need an ad-hoc build for this one, it should not change the behavior of the app. |
|
Will review today |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-01-21.at.12.48.45.mov |
|
✋ 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.3.6-0 🚀
|
|
@chrispader @carlosmiceli No QA steps mentioned, OK to check off this one? |
@m-natarajan sorry, i just added QA steps, but the info for it is pretty minimal. Basically, we just need to make sure, that the RBRs on the navigation tab bar are behaving expectedly. I think we'll only need to test the account and workspace indicators, as well as the one used in the |
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.3.6-4 🚀
|
@carlosmiceli @joekaufmanexpensify
Explanation of Change
Refactors the hooks around indicator status used in the
NavigationTabBar. The tests were updated refactored as well but do not differ in behaviour. An additional test suite foruseWorkspaceTabIndicatorStatushook was added.In #78305, the behavior of indicator status will change, therefore new test cases will be added.
Fixed Issues
$ #76438
PROPOSAL:
Tests
Offline tests
QA Steps
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