-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Refactor: Deprecate getPersonalPolicy (part 4) #79591
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
Refactor: Deprecate getPersonalPolicy (part 4) #79591
Conversation
|
@ikevin127 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] |
src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersCategoryPage.tsx
Show resolved
Hide resolved
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Reviewer Checklist
Screenshots/Videos
|
| const availableNonPersonalPolicyCategoriesSelector = useCallback( | ||
| (policyCategories: OnyxCollection<PolicyCategories>) => | ||
| Object.fromEntries( | ||
| Object.entries(policyCategories ?? {}).filter(([key, categories]) => { | ||
| if (key === `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${personalPolicyID}`) { | ||
| return false; | ||
| } | ||
| const availableCategories = Object.values(categories ?? {}).filter((category) => category.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); | ||
| return availableCategories.length > 0; | ||
| }), | ||
| ), | ||
| [personalPolicyID], | ||
| ); |
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.
🟢 Minor: This could be extracted to src/selectors/PolicyCategories.ts - but it's not a blocker for merge.
Reasoning
- Consistency with codebase conventions.
- Reusability if the same filtering logic is needed elsewhere.
- Testing - pure selector functions are easier to unit test.
Two considerations (if moved)
- Dependency on
personalPolicyID: The selector now depends on personalPolicyID which is passed via the useOnyx hook. Moving it to a pure selector file would require a factory pattern. - Current usage is singular: The selector is only used in
SearchFiltersCategoryPage.tsx- if there's no immediate reuse need, keeping it local is acceptable.
ikevin127
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.
✅ Additional manual tests (based on PR changes) that are all passing:
- Search → Advanced Filters → Category → Verify all categories from your workspace appear (even disabled ones), but there are no unexpected orphan categories from the personal policy.
- Self DM transaction → Description → type
#lol→ verify that no highlight occurs. - Workspace transaction → Description → type
#lol→ verify that highlight occurs. - Workspace chat → mention non-member → verify that "Invite to submit expense" and other Concierge action buttons appear.
🟢 LGTM
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #66397 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
✋ 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/justinpersaud in version: 9.3.4-0 🚀
|
|
🚀 Deployed to production by https://github.com/Beamanator in version: 9.3.4-6 🚀
|

Explanation of Change
Fixed Issues
$ #66397
Tests
#lolOffline tests
Same as 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
Screen.Recording.2026-01-14.at.11.25.43.PM.mov